Do u know this? Which no. Is not printed by this code? I'm getting error. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Do u know this? Which no. Is not printed by this code? I'm getting error.

try: print(1) print(20/0) print(2) except ZeroDivisonError: print(3) finally: print(4)

22nd Jun 2019, 6:29 AM
Ankit Tiwari
Ankit Tiwari - avatar
11 Answers
+ 6
ZeroDivisionError, not ZeroDivisonError. You're trying to catch an exception that doesn't exist, effectively raising another exception
22nd Jun 2019, 6:40 AM
Anna
Anna - avatar
+ 2
In "finally", it just says "print" with no brackets and string.
22nd Jun 2019, 8:28 AM
Mahv
Mahv - avatar
+ 2
NUKE Yeah. Also, you spelt ZeroDivisionError wrong?
23rd Jun 2019, 11:38 AM
Mahv
Mahv - avatar
+ 2
2
24th Mar 2021, 9:56 AM
Давид Давидов
Давид Давидов - avatar
+ 1
print(20/0) will raise an exception called ZeroDivisionError. You're trying to catch an exception with the name "ZeroDivisonError". The third "i" in "division" is missing. Trying to catch an exception that doesn't exist will raise another exception.
23rd Jun 2019, 12:10 PM
Anna
Anna - avatar
+ 1
2 is answer
2nd Jun 2022, 7:43 AM
Olive Grace
Olive Grace - avatar
+ 1
2
28th Aug 2022, 11:29 AM
OBII🦁
OBII🦁 - avatar
0
Anna i didn't get it! Please explain!
23rd Jun 2019, 11:37 AM
Ankit Tiwari
Ankit Tiwari - avatar
0
Mahv sorry it was print(4)
23rd Jun 2019, 11:37 AM
Ankit Tiwari
Ankit Tiwari - avatar
0
2
5th Sep 2022, 1:12 AM
Opanuga Stephen
Opanuga Stephen - avatar
- 1
Ohhh spelling mistake,silly me. thanks Anna
23rd Jun 2019, 1:54 PM
Ankit Tiwari
Ankit Tiwari - avatar