I'm trying to get an accurate age but this doesn't work it gives me errors and sometimes repeats itself. I've been trying to get it to work for hours. But I can't figure it out, I think the problem is in finally
. I tried except
but it just gives me errors. How should I fix it?
end04 = False
while not end04:
Age = input("Age: ")
try:
int(Age)
end04 = True
finally:
if Age[-1:] == 'w':
Age.replace('w','')
int(Age)
Age /= 52
end04 = True
elif Age[-1:] == 'm':
Age.replace('m', '')
int(Age)
Age /= 12
end04 = True
else:
end04 = False
print("Only enter m or w after number or just number")
if I put finally It just repeats saying "Only enter m or w after a number or just number"
If I put except it gives an error (When I enter 3m)
int(Age) ValueError: invalid literal for int() with base 10: '3m'