Reputation: 21
I'm making a turn based game in Python. At one point, I need to generate a random number out of a hundred and see if it is in-between two numbers. It needs to be in the if statement.
elif random.randint(0,100) #is equal a number between 20 and 60
Is there a way to do this?
Upvotes: 0
Views: 697
Reputation: 3955
if low < random.randint(0,100) < high
does the job well, unless you want to store the random value in a variable
Upvotes: 3