Help a noob out

DL Neil PythonList at DancesWithMice.info
Thu May 2 07:33:01 EDT 2019


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
> ar at zeit.io


+1

-- 
Regards =dn



More information about the Python-list mailing list