+ 1
Please help me correct thi code
age = input ("give your age.\nyour age was:") print (age) if int (age) < 18: print ("you are so young!") if int (age) > 18 and int (age)< 100: print ("wellcome") else: print ("are you right?!") I havproblem in the numbers between 18 and 100 thanks
4 Answers
+ 5
You guys might want to change this line:
if int(age) > 18 and int(age) < 100:
to:
elif int (age) > 18 and int (age) < 100:
Or actually:
age = int(input("give your age.\nyour age was:"))
print(age)
if 0 < age < 18:
print("you are so young!")
elif 18 <= age <= 100:
print("welcome!")
else:
print("are you right?!")
+ 6
The problem is indenting - see below
age = input ("give your age.\nyour age was:")
print (age)
if int (age) < 18:
print ("you are so young!")
if int (age) > 18 and int (age)< 100:
print ("wellcome")
else:
print ("are you right?!")
This should work.
+ 2
thanks a lot to @kuba
+ 1
thanks a lot david.
the problem solved but
now there are two answers for below of 18š