+ 1
Raising Exeptions
I didn't get the point of raising exeptions in python can you please explain more and easy to me
4 Respuestas
+ 8
Maybe this will help you understand:
https://code.sololearn.com/c0iKAVH4B7wl/?ref=app
+ 11
An exception is raised when the interpreter encounters an operation it can't resolve. There is always an exception type associated with it. For example, a classic division by zero raises an exception ZeroDivisionError, raising a string to the power raises TypeError and so on.
When building a code, you might want to intentionally raise an error of a certain type, just to make sure your program stops and does not continue to run. Especially, if it could do damage with wrong input or corrupt data.
You then use the 'raise' keyword which triggers an exception to be raised. You may specify which error type to raise, too.
+ 2
thank you so much
+ 1
what do you mean from raise an exeption
It the exact point that I couldn't understand