A: int("") in the else block raises a ValueError, which is not caught by NameError. Unhandled exception.
B: 0/0 in try raises ZeroDivisionError, caught by except:. 0/1 executes. else is skipped. No unhandled exception.
C: math.sqrt(-1) in try raises ValueError, caught by except:. math.sqrt(0) executes. else is skipped. No unhandled exception.
D: float("1c1") in the else block raises a ValueError, which is not caught by (NameError, SystemError). Unhandled exception.
A returns:
File "<string>", line 6, in <module>
ValueError: invalid literal for int() with base 10: ''
B returns 0.0
C. returns 0.0
D returns:
File "<string>", line 2, in <module>
ValueError: could not convert string to float: 'lel'
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Abbribas
1 month, 2 weeks agokostadiv
5 months agoflthymcnsty
8 months, 3 weeks ago