Python Master Guide: Functions, Methods &
Examples
1. Built-in Functions
1 len(x) – length | len([1,2,3])
2 type(x) – data type | type(10)
3 sum(iterable) | sum([1,2,3])
4 min(), max() | max([4,1,9])
5 sorted(iterable) | sorted([3,2,1])
6 range() | list(range(1,5))
2. List Methods
1 append(x) | [Link](5)
2 insert(i,x) | [Link](1,10)
3 extend(iterable) | [Link]([3,4])
4 remove(x) | [Link](2)
5 pop() | [Link]()
6 sort(), reverse()
3. Tuple Methods
1 count(x)
2 index(x)
4. Dictionary Methods
1 keys(), values(), items()
2 get(key)
3 update(dict)
4 pop(key), popitem()
5 setdefault()
5. String Methods
1 upper(), lower(), title()
2 strip(), split(), join()
3 replace()
4 find(), index()
5 startswith(), endswith()
6. Set Methods
1 add(), update()
2 remove(), discard()
3 union(), intersection()
4 difference()
7. Functional Programming
1 map()
2 filter()
3 lambda functions
4 reduce()
8. File Handling
1 open(), read(), write()
2 with statement
3 CSV & text files
9. Exception Handling
1 try-except
2 finally
3 custom exceptions
10. OOP Methods
1 __init__()
2 __str__()
3 classmethod
4 staticmethod
5 inheritance