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")