try and except keywords are used in Python for try and catch. Indentation plays an important role in try and catch statements in Python.
Example:
#Expecting age value from the employee
strAge = input(
'Please share your age'
);
try:
#Converting string to integer
intAge = int( strAge );
#Printing the voting ability
if intAge < 18 :
print(
'You are not eligible for voting.'
);
elif intAge <= 58:
print(
'You are eligible for voting.'
);
else :
print(
'You are a senior citizen with Voting rights.'
);
except:
print(
'You have entered incorrect age value'
);
print( 'Thank you!' );