Create a library with functions to input the values with exception handling in Python
belongs to collection: Python Exception Handling Programs
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
belongs to collection: Python Exception Handling Programs
total answers (1)
Here, we are creating a Python library "MyLib.py" with two functions,
When we input the values other than integer/float the ValueError will occur, this error is also being handled in the functions.
Then, we are creating a main file "Main.py", where we are reading and printing the values.
MyLib.py:
Main.py:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer