Skip to content
Learnearn.uk » Python Unit Home » In built functions & Methods

In built functions & Methods

Add a starter here…

Python Standard in-built functions

Standard in-built functions are functions that you can use ‘straight out of the box’.

Examples of standard functions that you have already used:

help() – displays help on an item

list() – turns something in to a list and returns the list

max() – returns the highest value in a list

min() – returns the lowest value in a list

sort() – sorts a list (in-place)

sorted() – returns a sorted version of a list, but doesn’t edit the original.

Python importable In-built functions

Python has lots of other functions that are available if you import them, but aren’t available as standard. You have already used some of these:

random/randint – Returns a random number between two values

random/shuffle – Shuffles a list(in place)

statistics/mean – gets the mean average from a list

Full list of importable modules, just to blow your mind.

Top python external modules ( you have to install them) that are really useful. More here…

Python In-built methods

These are a little different because they can’t be called by themselves, they need an object to be called against. You know this is the case because you have to use .somemethod(), inlcuding the full-stop.

Examples

“dog”.upper() –> Returns an uppercasse version of the string

mylist.sort() –> Sorts the list alphabetically.

 

 

https://docs.python.org/2/library/functions.html