If I enter any value less than 24, it does print the "You will be old..." statement. If I enter any value greater than 24 (ONLY up to 99), it prints the "you are old" statement.
The problem is if you enter a value of 100 or greater, it prints the "You will be old before you know it." statement.
print ('What is your name?')
myName = input ()
print ('Hello, ' + myName)
print ('How old are you?, ' + myName)
myAge = input ()
if myAge > ('24'):
print('You are old, ' + myName)
else:
print('You will be old before you know it.')
int(myAge) > 24:
and it should work. - Keiwan'24'
is a string and not a number, so when you do comparisons to it, something like'100'
comes before'24'
because'1'
comes before'2'
. This is called lexicographic ordering. - wkl