This module focuses on exception handling in Python, including the use of try and except, custom exceptions,
and managing errors effectively in code.
- Solution
- Description:
Task "Programmers Can Do Everything":
- Implement a function
add_everything_upthat can add integers, floats, and strings together. If a number is added to a string, it should return the string representation of both instead of raising a TypeError.
- Implement a function
- Solution
- Description:
Task "Count and Average":
- Create two functions:
personal_sumto calculate the sum of numeric values in a collection, handling TypeErrors for non-numeric values.calculate_averageto compute the average usingpersonal_sum, handling ZeroDivisionError and TypeError for invalid data types.
- Create two functions:
- Solution
- Description:
Task "Inaccuracy":
- Implement a
Carclass with methods for validating VIN and number attributes. Create two custom exception classes,IncorrectVinNumberandIncorrectCarNumbers, to handle validation errors when creating instances ofCar.
- Implement a