0
What is wrong in my python code please help!
s=input("Enter your age:") if s < 0: print("no existance") if s < 13: print("child") if s < 18: print("teen") if s < 40: print("adult") if s < 100: print ("old")
7 Réponses
+ 11
1. Your input must be converted to int
2. Your indentation is messed up which is wrong in python
3.(optional)Logic is not correct
s = int(input("Enter your age:"))
if s < 0:
print("no existance")
elif s < 13 and s >= 0:
print("child")
elif s < 18 and s >= 13:
print("teen")
elif s < 40 and s >= 18:
print("adult")
elif s < 100 and s >= 40:
print ("old")
else:
print("Alien!")
+ 2
s=int(input("Your Age:'))
0
I tried to nest each statement into each other so that it's a series of checking. like if age<0 is false it will go to age<13 and so on until a condition is satisfied. can you please point out what is wrong in my logic? And also what is crrect indention. Thank you so much btw :)
0
like I just reached the if condition so no idea about 'elif' so is it not possible wihout just if ?
0
s=int((input("Enter your age:"))
if s < 0
print("no existance")
if s < 13
print("child")
if s < 18
print("teen")
if s < 40
print("adult")
if s < 100
print ("old")
implemented the int(input) as you said, but still doesn't work
0
I said just for the first line, you need to use the code @Cool gave.
0
yes the input error went away, but still I'm not getting any output :(