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



> On 02-May-2019, at 2:50 PM, felixen...@hotmail.co.uk wrote:
> 
> birth_year = input("What year are you born? ")
> current_year = 2019
> age = current_year - birth_year
> print(age)

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to