0

Please correct where I am going wrong as i cannot get output

def number_game(x,y): num = range(10,2) for i in num: if 10 > 2: print(i+1 in (10,2)) else: return i%2 == 1

15th Feb 2019, 9:48 AM
TCA
2 Answers
+ 2
I think you should create num variable like this. num=range(10,2,-1) Now it can iterate.
15th Feb 2019, 11:34 AM
Maninder $ingh
Maninder $ingh - avatar
+ 1
The statement: "num = range(10,2)" Creates an object of "range" type. It can't be iterated, so it returns nothing in the next line: "for i in num".
15th Feb 2019, 10:41 AM
Pedro Tortello
Pedro Tortello - avatar