Skip to content

Latest commit

 

History

History

README.md

0x05. Python - Exceptions

Python project that includes solutions to various questions related to Python exceptions.

Learning Objectives

At the end of this project, you are expected to be able to explain to anyone, without the help of Google:

  • Why Python programming is awesome
  • The difference between errors and exceptions
  • What exceptions are and how to use them
  • When to use exceptions
  • How to correctly handle an exception
  • The purpose of catching exceptions
  • How to raise a built-in exception
  • When to implement a clean-up action after an exception

Requirements

  • Allowed editors: vi, vim, emacs
  • All files will be interpreted/compiled on Ubuntu 20.04 LTS using python3 (version 3.8.5)
  • All files should end with a new line
  • The first line of all files should be exactly #!/usr/bin/python3
  • A README.md file, at the root of the folder, is mandatory
  • Code should use the pycodestyle (version 2.8.*) style
  • All files must be executable
  • The length of your files will be tested using wc

Files

File Description
0-safe_print_list.py Function that prints x elements of a list
1-safe_print_integer.py Function that prints an integer
2-safe_print_list_integers.py Function that prints the first x integers of a list
3-safe_print_division.py Function that divides 2 integers and prints the result
4-list_division.py Function that divides element by element 2 lists
5-raise_exception.py Function that raises a type exception
6-raise_exception_msg.py Function that raises a name exception with a message
100-safe_print_integer_err.py Function that prints an integer and handles errors
101-safe_function.py Function that executes a function safely
102-magic_calculation.py Python function that replicates given bytecode
103-python.c C functions to print info about Python objects

Usage

Each file is a standalone Python script and can be executed separately.

$ ./filename.py

Author

Created by Guillaume and solved by Silas, ALX Software Engineering Student.

License

Feel free to copy and paste this content into your README.md file for your repository.