+ 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

12th Dec 2017, 8:28 PM
Yusuf Nazari
Yusuf Nazari - avatar
4 Respostas
+ 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?!")
12th Dec 2017, 10:09 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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.
12th Dec 2017, 8:38 PM
David Ashton
David Ashton - avatar
+ 2
thanks a lot to @kuba
13th Dec 2017, 3:40 AM
Yusuf Nazari
Yusuf Nazari - avatar
+ 1
thanks a lot david. the problem solved but now there are two answers for below of 18😕
12th Dec 2017, 8:44 PM
Yusuf Nazari
Yusuf Nazari - avatar