
Hiep L. answered 04/27/19
Tutor
New to Wyzant
Adjunct Professor at HCC - teaching C++/C#/Java/Python
Use the keyword 'raise' and specify the exception you want to raise. Your except needs to look for the same exception to catch it. For example,
try:
:
raise InvalidNumException
except InvalidNumException:
print("Invalid number received,")