lundi 17 décembre 2018

python 3.7 skips if statement, what goes wrong

So I am new to python 3.7, and trying to write a simple code that asks your name, age and then calculates the year you'll become 100. the code I came up with is as follow:

naam = input("what is your name? ")

leeftijd = int (input( "and how old are you?"))

print( "Hello " + naam + " so you are " + str(leeftijd))

when_100 = input("would you like to know when you become 100?")

if when_100 == 'yes':
   new_date =  (2018-leeftijd)+100
   print("you shall become 100 in the year " + str(new_date))

else:
    print("what a shame")

however, result is always "what a shame"... the other answers i found on the if statement skip did not help...

what goes wrong in the if statement?

Aucun commentaire:

Enregistrer un commentaire