I'm a python newbie and I'd like to understand how I can avoid getting TypeError error from my Try and Except function with zeros.
Given:
a= 0 (usually I have a number (>=1), but I could get 0 as an input)
b= 0 (usually I have a number (>=1), but I could get 0 as an input)
Here is the code:
try:
h = a/b
except ZeroDivisionError:
h = 0
Here is the error message:
TypeError: catching classes that do not inherit from BaseException is not allowed