try:
age = int(input('Age: '))
income = 20000
risk = income / age
print(risk)
except ZeroDivisionError:
print('Age cannot be 0')
except ValueError:
print('Invalid value')
Age: u
Invalid value
Age: 0
Age cannot be 0
Age: 10
2000.0
No comments:
Post a Comment