Built-in Python Functions Guide
Below you will find a table that includes the built-in functions and methods we have
covered so far.
Common and Useful Functions
These are some common functions you’ll likely use frequently in your code.
Common Types
Function Description It Works On Examples
print() “Prints” the value to the screen Practically all print(1)
(especially useful for strings) Python types print(’two’, True)
display() Very similar to print() but used most Practically all display(1)
often in Jupyter Notebook Python types display(’two’, True)
help() Gives “help” and documentation on Practically all help(print)
Python objects, including functions Python types
type() Returns the Python type Practically all type(1)
Python types type(1.0)
str() Casts other Python objects to strings Practically all str(1)
Python types str(1.0)
int() Casts other Python objects to Most types with int(‘10’)
integers some exceptions int(10.8675309)
float() Casts other Python objects to Most types with float(‘10’)
floating point numbers some exceptions float(10)
bool() Casts other Python objects to either Practically all bool(‘Hi’)
True or False Python types bool(0)
range() Returns a sequence of numbers Integer types range(5)
starting from 0, incrementing by 1 by range(5, 100, 5)
default
Type Specific Functions & Methods
Remember, functions and methods are very similar but methods use the “dot” notation.
Function
or Method Description Common Types It Works On Examples
.upper() Method to capitalize Strings “What’s that?”.upper()
all letters in string “1 + 1 is two”.upper()
.lower() Method to lowercase Strings “What’s that?”.upper()
all letters in string “1 + 1 Is TWO”.upper()
.split() Method to break Strings ‘1;1;2;3;5;7’.split(‘;’)
string up into ‘How are you?’.split()
elements in a list by
some separator
.join() Method to join Lists, Strings, Tuples ‘ ‘.join([‘Hello’, ‘world’])
elements in a list
using some separator
len() Returns the size of Strings, Lists len(‘expialidocious’)
the object len([‘one’,’two’,’three’])
min() Returns the smallest Lists (of comparable types) min([1, 2.01, 3])
value in a list min([‘a’, ‘b’, ‘c’])
max() Returns the largest Lists (of comparable types) max([1, 2.01, 3])
value in a list max([‘a’, ‘b’, ‘c’])
Data Structure Functions & Methods
Lists and dictionaries have some useful functions and methods specific to them.
Function Common Types
or Method Description It Works On Examples
sum() Adds all the values in a list together List (of numerical sum([2, 4, 3, 1])
to get a total values)
.append() Adds one new element to a list Lists my_list.append(‘new’)
.pop() Removes the element at the given Lists my_list.pop()
index. Defaults to removing the last my_list.pop(2)
element
.keys() Gives all the “keys” from a dictionary Dictionaries my_dictionary.keys()
.values() Gives all the “value” from a Dictionaries my_dictionary.values()
dictionary
.items() Gives all the “keys” and “values” as Dictionaries my_dictionary.items()
pairs from a dictionary