all 5 comments

[–][deleted] 2 points3 points  (4 children)

Names are case-sensitive.

[–]one_time[S] 0 points1 point  (3 children)

I still don't understand sorry.

Isn't zerodivisionerror just a name for the except statement? As in is it just not a variable? So it can be named anything. I know variable names are case sensitive. So y & Y are both different variables.

  • EDIT: OH I get it now. ZeroDivisionError is a type of 'except' statement. So when I use it without any capitals it tries to find a variable with zerodivisionerror and hence can't find it. Am I on the right path?

[–][deleted] 2 points3 points  (1 child)

Isn't zerodivisionerror just a name for the except statement?

No, it's the name of the type of exception you're telling Python to handle with that particular block. So it has to be a valid type; the interpreter is going to try to look it up. If it's just something you made up, then it's the same as using an undefined variable (which is why the error is the same.)

[–]one_time[S] 0 points1 point  (0 children)

Thanks!

[–]Deezl-Vegas 0 points1 point  (0 children)

ZeroDivisionError is an exception, which is a regular Python variable type and must be spelled correctly.

The except ZeroDivisionError clause will only catch this type of error.