li = [1, 2, 3, 4]
li[start:end:step]
li[0] # Return first element => 1
li[-1] # Return last element => 4
li[1:3] # Return list from index 1 to 3 => [2, 3]
li[::2] # Return list selecting every second entry => [1, 3]
li[::-1] # Return list in reverse order => [4, 3, 2, 1]
del li[2] # li is now [1, 2, 4]
1 in li
list.append(x) # append x to end of list
list.extend(iterable) # append all elements of iterable to list
list.insert(i, x) # insert x at index i
list.remove(x) # remove first occurance of x from list
list.pop([i]) # pop element at index i (defaults to end of list)
list.clear() # delete all elements from the list
list.index(x[, start[, end]]) # return index of element x
list.count(x) # return number of occurances of x in list
list.reverse() # reverse elements of list in-place (no return)
list.sort(key=None, reverse=False) # sort list in-place
list.copy() # => shallow copy of the list
list.get(key, default=None)
dictionary.keys()
dictionary.values()
dictionary.items()
len(li) # => 3
zip(*iterables) # => iterator of tuples, pairing elements from iterables
filter(function, iterable) # => iterator containing elements where function returns True
map(function, iterable) # => iterator with result of function for each element
sorted(iterable, key=None, reverse=False) # => sorted list
sum(iterable, start=0) # => sum of all elements in iterable
min(iterable) # => minimum element in iterable
max(iterable) # => maximum element in iterable
len(iterable) # => number of elements in iterable
enumerate(iterable, start=0) # => iterator of tuples with generated indices and values from iterable
reversed(sequence) # => iterator with reverse order
any(iterable) # => True if any element in iterable is True else False
all(iterable) # => True if all elements in iterable are True else False
set1 == set2 # Equality - Checks if two sets contain the same elements
set1 != set2 # Inequality - Checks if two sets do not contain the same elements
set1 <= set2 # Subset - Checks if one set is a subset of another (including equal)
set1 >= set2 # Superset - Checks if one set is a superset of another (including equal)
range_(start, stop, step_)
list(range(10, -2, -3)) # => [10, 7, 4, 1]
my_list = [x for x in iterable]
my_tuple = tuple(x for x in iterable)
my_set = {x for x in iterable}
my_dict = {key: value for key, value in iterable}
a, b, c = (1, 2, 3) # a is now 1, b is now 2 and c is now 3
a, *b, c = (1, 2, 3, 4) # a is now 1, b is now [2, 3] and c is now 4
d, e, f = 4, 5, 6 # tuple 4, 5, 6 is unpacked into variables d, e and f
e, d = d, e # d is now 5 and e is now 4