On 2/05/19 9:30 PM, Arup Rakshit wrote:
The input function returns the string value. So you need to convert it to 
number before the math you do.


birth_year = input("What year are you born? ")
current_year = 2019
print(type(birth_year))
age = current_year - int(birth_year)
print(age)

—————

python3 age.py
What year are you born? 1989
<class 'str'>
30

Thanks,

Arup Rakshit
a...@zeit.io


+1

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to