0
Something is wrong with my code... [Answered thank you.]
I'm trying to make a base that does >=17 no <=18 yes <=100 wow Link https://code.sololearn.com/c3937hR7rxvq/?ref=app
9 Réponses
+ 5
Mark,
The else is the base case, elif needs to go above:
Also 101 would stop on the first case as you are over 18.
This would work:
age = int(input())
if age >= 100:
print("old")
elif age >= 18:
print("allowed")
else:
print("Sorry, You need to leave.")
+ 1
Alright, That one worked. Thank you!
+ 1
Mohammad, this was already answered - the elif condition will never fire (needs >= 100 and also to be moved to the top)
0
Can you send a copy of it please?
0
It still says Allowed in though...
0
Oh I see, it needs to be above 100 not below it. My bad, I forgot to elaborate more.
0
Also works, Thank you.
0
age = int(input())
if age >= 18:
print("Allowed in! Cmon! Lets go have fun!")
elif age <=100:
print("w h a t t h e")
else:
print("Sorry, You need to leave.")
0
Elif comes before else