+ 1

Range function

range = list(range(-100,10000,77)) guess = input() if guess in range: print("Win") else: print("Loss") # why does this boolean always return False? (“loss”)

9th May 2019, 7:32 PM
Paras finn
Paras finn - avatar
2 Answers
+ 11
guess = int(input())
9th May 2019, 7:34 PM
Anna
Anna - avatar
+ 2
It looks like you set a variable to the same name as a function, this can confuse the interpreter as it is not sure which you mean. Also you can just use if guess in range(-100,10000,77)): Anna is also right since your input is a string you need to specify it as an int
9th May 2019, 9:11 PM
Brian Petry
Brian Petry - avatar