Input() on digits


hey guys,
I'm trying torun this code but no matter what I put it gives me always the same answer.
Can you check what I'm missing here?

thank you!

q= input("""how old are you?

if q >= int(18):
print ("you're a grown up!")
elif q < int(18):
print ("you're a kid!")
print("insert digits for answer. (ex: 14, 20, 31...)")


Not sure why you put this in functions but...

You're using a lot of things that are really unnecessary for this simple of a program. It might be better if it looked like this:

q = int(input("How old are you?" ) #Sets your variable q to an integer that is the response to your question.

if (q>=18):
     print("You're a grownup!")
elif( q<18):
     print("You're a kid!")
     print("You have to tell me your age!")

That will get it done a lot faster and easier.


Thank you very much! I got why in my way it wasn't working


I'm happy to be of service.


Use raw_input in python2, input does a whole lot more than its name suggests.

In python3, raw_input got renamed to input


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.