0
Dont clearly understand whats happening. Pls help!
I tried getting both exceptions to come up but the program kept choosing the last exception alone as output despite there being errors to bring up both exception. Pls whats going on. try: Variable=10 M=0 print(variable +'' ") print(variable/M) except ZeroDivisionError: print("divided by zero") except(TypeError, ValueError): print('Error occured')
3 Réponses
+ 2
Python is interpreted line by line therefore exception 1st will only detect 1st print function and it won't detect the 2nd unless the 1st print function gets stable and so exception 1 gets false and skipped.
0
So ur saying that multiple exceptions cant come up at a time in python, as 1 appears it must me attended to b4 the next exception can come up.
0
Yes.