In this project, I learned handling errors and exceptions in Python with try
and except
.
- Python Scripts are written with Python 3.4.3
- C files are compiled using
gcc 4.8.4
- Tested on Ubuntu 14.04 LTS
Filename | Description | Prototype |
---|---|---|
0-safe_print_list.py |
Function that prints x elements |
def safe_print_list(my_list=[], x=0): |
1-safe_print_integer.py |
Function that prints an integer with "{:d}".format() |
def safe_print_integer(value): |
2-safe_print_list_integers.py |
Function that prints the first x elements of a list and only integers |
def safe_print_list_integers(my_list=[], x=0): |
3-safe_print_division.py |
Function that divides 2 integers and prints the result | def safe_print_division(a, b): |
4-list_division.py |
Function that divides element by element 2 lists | def list_division(my_list_1, my_list_2, list_length): |
5-raise_exception.py |
Function that raises a type exception | def raise_exception(): |
6-raise_exception.py |
Function that raises a name exception with a message | def raise_exception_msg(message=""): |
100-safe_print_integer_err.py |
Function that prints an integer | def safe_print_integer_err(value): |
101-safe_function.py |
Function that executes a function safely | def safe_function(fct, *args): |
102-magic_calculation.py |
Function that does exactly the same as a Python bytecode given | def magic_calculation(a, b); |
103-python.c |
C functions that print some basic info about Python lists, Python bytes objects and Python float objects |
|