import traceback
def calculator():
age = input("Input dog years: ")
try:
d_age = float(age)
if d_age < 0 :
print('Age cannot be a negative number.')
elif d_age <= 1.0 and d_age > 0 :
h_age = 15 * d_age
elif d_age <= 2.0 and d_age > 1.0 :
h_age = 12 * d_age
elif d_age <= 3.0 and d_age > 2.0 :
h_age = 9.3 * d_age
elif d_age <= 4.0 and d_age > 3.0 :
h_age = 8 * d_age
elif d_age <= 5.0 and d_age > 4.0 :
h_age = 7.2 * d_age
else:
h_age = ( 7 * d_age ) + 1
print(f'The given dog age {round(d_age,2)} is {round(h_age,2)} in human years.')
except:
print(age, "is an invalid age.")
print(traceback.format_exc())
calculator()