0
Whats meaning of these statements?
In python statements are using "try", "except" and c++ or c# using "try" and "catch" statements tharefore i having some doubtz ,please explain which someone who can.
4 odpowiedzi
+ 7
This is called exception handling. You put part of your code which might blow out inside this block, so that the program does not crash.
For example:
x = input("Enter your age: ")
try:
age = int(x)
except:
print("Wrong input!")
Now if you didn't use try-except and the user enters 'xxx' as the input, the int() could not convert to a number and the program would crash. If you use try-except, you can continue with the rest of the code eventhough you encountered an error.
+ 6
try/except is basically the try/catch block in Python.
0
exception handling.
0
thanks #kuba i will.. ☺