+ 1
17th Aug 2019, 6:12 AM
Bawantha Nawela
Bawantha Nawela - avatar
7 Réponses
+ 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")
17th Aug 2019, 6:15 AM
Sarvesh Yadav
Sarvesh Yadav - avatar
+ 4
You can shorten line 2 a bit: if 50 <= x <= 100: 😎
17th Aug 2019, 7:33 AM
David Ashton
David Ashton - avatar
+ 3
Bawantha Nawela you forgot to condition your elif inorder to get the else: to print
17th Aug 2019, 7:10 AM
BroFar
BroFar - avatar
+ 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
17th Aug 2019, 6:17 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
17th Aug 2019, 7:51 AM
BroFar
BroFar - avatar
+ 1
David Ashton very true but he did not condition his elif and falls through to else: print('fail')
17th Aug 2019, 7:55 AM
BroFar
BroFar - avatar
17th Aug 2019, 6:22 AM
Bawantha Nawela
Bawantha Nawela - avatar