I'm new to python and this is what i came up with, it does not work.
age = input("How old are you? ")
if age < 18
    print("You are under age.")
else
    print("You are over age")
Thanks.
I'm new to python and this is what i came up with, it does not work.
age = input("How old are you? ")
if age < 18
    print("You are under age.")
else
    print("You are over age")
Thanks.
 
    
     
    
    The result of the input function must be convert to an int by using the int constructor, like int("123") in order to be compared to the number 18.
if int(input("How old are you?")) < 18:
  print("You are under age")
else:
  print("You are over age")
 
    
    What is the type of input? Hmm let's open the REPL and see.
$ ipython
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: age = input('how old are you?')
how old are you?10
In [2]: type(age)
Out[2]: str
In [5]: age == '10'
Out[5]: True
In [6]: age == 10
Out[6]: False
See how Python treats the type str different from int?
You're also forgetting colons : after your if statememt