+ 2

How to set range for something.?

for example : to set range for marks of subject pass or fail?

15th Feb 2017, 5:00 PM
Jainish Shah
Jainish Shah - avatar
6 Antworten
+ 8
marks=int(input("Enter your mark")) if( 40 <= marks <=100 ): print('PASS') else: print('FAIL') I HOPE THIS HELPS.👻 [EDIT]: Thanks for the correction Alvaro. 👻
15th Feb 2017, 5:26 PM
Mr.Robot
Mr.Robot - avatar
+ 5
Watch it, @Mr.Robot! The code should look like... [EDIT] Mr.Robot corrected the code.
15th Feb 2017, 5:39 PM
Álvaro
+ 4
Jainish You can do it as follow.. for i in range(1,10): print(i) output:- 1 2 3 4 up to 9.
27th Mar 2017, 7:24 PM
Ritesh Patel
Ritesh Patel - avatar
+ 3
make a list and set your range in it.. -------------------------------------------- good=[] for i in range(70,100): good.append(i) -------------------------------------------- Then you can just check if the mark is in the list. if mark in good:
15th Feb 2017, 5:54 PM
LordHill
LordHill - avatar
0
dear Mr robot it is not running
3rd Mar 2017, 12:31 PM
Jainish Shah
Jainish Shah - avatar
0
Mr robot can you suggest me another method
3rd Mar 2017, 12:32 PM
Jainish Shah
Jainish Shah - avatar