My Daughter (10) has started to teach herself programming and is set on learning Python, she has got a lot of inspiration and asistance from youtube and some forums.
She is trying to write a programme that will advise on your age, but cannot compare the input with the parameter in python.
name = input("what is your name?")
print ("Hello", name)
age = input("how old are you")
if age < 35:
print ("thats young")
elif age > 60:
print ("thats old")
I think the problem is comparing a string with an integer.
Anybody have an idea how to turn the string into an integer, so that they can be compared? or another solution.
The error message tells us the error is on line 5, but I do not have the complete eror message.
She is trying to write a programme that will advise on your age, but cannot compare the input with the parameter in python.
name = input("what is your name?")
print ("Hello", name)
age = input("how old are you")
if age < 35:
print ("thats young")
elif age > 60:
print ("thats old")
I think the problem is comparing a string with an integer.
Anybody have an idea how to turn the string into an integer, so that they can be compared? or another solution.
The error message tells us the error is on line 5, but I do not have the complete eror message.



Comment