+ 2

In py try/except if any error comes in try will it go to except???

try: num1 = 7 num2 = 7 print num1 / num2) print("Done calculation") except ZeroDivisionError: print("An error occurred") print("due to zero division") y am I getting syntax error as per explanation it should go to except

20th Feb 2018, 5:29 AM
Pradeep Vc
Pradeep Vc - avatar
2 Answers
+ 1
Syntax error --> missing parenthesis in print (num1/num2)
20th Feb 2018, 5:48 AM
Sylar
0
You did not write the pharenthesis at num1/num2
24th Feb 2018, 8:42 PM
Petrache Mihnea
Petrache Mihnea - avatar