Try Except and Else block in Python
Try Except is a syntax for error handling in Python. Else block is optional and is executed only if program runs successfully without encountering any exception.
a=40
b=10
try:
c=a/b
print(c)
except:
print("Cant divide by 0")
else:
print("Success")
Comments
Post a Comment
Write something to CodeWithAbdur!