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)
—
py
Den torsdag 2 maj 2019 kl. 11:43:53 UTC+2 skrev inhahe:
> On Thu, May 2, 2019 at 5:26 AM wrote:
>
> > Hey guys, can someone quickly explain why this piece of code doesn't work?
> > (I'm really new to Python)
> >
> > birth_year = input("What year are you born? ")
> > current_year = 2019
> > age =
On Thu, May 2, 2019 at 5:26 AM wrote:
> Hey guys, can someone quickly explain why this piece of code doesn't work?
> (I'm really new to Python)
>
> birth_year = input("What year are you born? ")
> current_year = 2019
> age = current_year - birth_year
> print(age)
> --
> https://mail.python.org/ma
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
On Thu, May 2, 2019 at 7:26 PM wrote:
>
> Hey guys, can someone quickly explain why this piece of code doesn't work?
> (I'm really new to Python)
>
> birth_year = input("What year are you born? ")
> current_year = 2019
> age = current_year - birth_year
> print(age)
Have you looked at the excepti
Hey guys, can someone quickly explain why this piece of code doesn't work? (I'm
really new to Python)
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