+ 1
Why middle elif statement not working?
7 Antworten
+ 2
you have not added the limit in first if condition...Here is improved one
x=int(input("ENTER MARKS:"))
if x>=50 and x<=100:
print("Pass")
elif x>100:
print("Error")
else:
print("Fail")
+ 4
You can shorten line 2 a bit:
if 50 <= x <= 100:
😎
+ 3
Bawantha Nawela you forgot to condition your elif inorder to get the else: to print
+ 1
Bawantha Nawela your if statement should be like below :
if x>=50 and x <=100:
without and condition, for greater than 100 i.e. 101 also, if condition is executed
+ 1
Your code but modified as
https://code.sololearn.com/catZ6vyyXnBU/?ref=app
+ 1
David Ashton very true but he did not condition his elif and falls through to else: print('fail')
0
Sarvesh ✓ Ketan Lalcheta Thanks guys