This directory contains projects focused on understanding and implementing exception handling in Python. The tasks cover concepts such as catching and raising exceptions, using try/except blocks, and ensuring clean-up actions after exceptions.
- Why Python programming is awesome
- What’s the difference between errors and exceptions
- What are exceptions and how to use them
- When do we need to use exceptions
- How to correctly handle an exception
- What’s the purpose of catching exceptions
- How to raise a builtin exception
- When do we need to implement a clean-up action after an exception
Task | File | Description |
---|---|---|
0. Safe list printing | 0-safe_print_list.py | Write a function that prints x elements of a list and only integers. |
1. Safe printing of an integers list | 1-safe_print_integer.py | Write a function that prints an integer with "{:d}".format() . |
2. Print and count integers | 2-safe_print_list_integers.py | Write a function that prints the first x elements of a list and only integers. |
3. Integers division with debug | 3-safe_print_division.py | Write a function that divides 2 integers and prints the result. |
4. Divide a list | 4-list_division.py | Write a function that divides element by element 2 lists. |
5. Raise exception | 5-raise_exception.py | Write a function that raises a type exception. |
6. Raise a message | 6-raise_exception_msg.py | Write a function that raises a name exception with a message. |
7. Safe integer print with error message | 100-safe_print_integer_err.py | Write a function that prints an integer or an error message if the value is not an integer. |
8. Safe function | 101-safe_function.py | Write a function that executes a function safely. |
9. ByteCode -> Python #4 | 102-magic_calculation.py | Write the Python function def magic_calculation(a, b): that does exactly the same as a given Python bytecode. |
10. CPython #2: PyFloatObject | 103-python.c | Create three C functions that print some basic info about Python lists, bytes, and float objects. |