C
C. N. Desrosiers
Hi,
I'm just starting out with Python and to practice I am trying to write a script that can have a simple conversation with the user.
When I run the below code, it always ends up printing response to "if age > 18:" -- even if I enter a value below 18.
Can anyone point me to what I am doing wrong? Many thanks in advance.
age=raw_input('Enter your age: ')
if age > 18:
print ('Wow, %s. You can buy cigarettes.' % age)
else:
print ('You are a young grasshopper.')
I'm just starting out with Python and to practice I am trying to write a script that can have a simple conversation with the user.
When I run the below code, it always ends up printing response to "if age > 18:" -- even if I enter a value below 18.
Can anyone point me to what I am doing wrong? Many thanks in advance.
age=raw_input('Enter your age: ')
if age > 18:
print ('Wow, %s. You can buy cigarettes.' % age)
else:
print ('You are a young grasshopper.')