I was trying to code a simple program:
import random
x = raw_input("How many rounds:")
rounds = 0
while rounds < x:
# rock=0, paper=1, scissors=2
computer1 = random.randint(0,2)
computer2 = random.randint(0,2)
if computer1 == computer2:
print "draw"
elif computer1 == 0 and computer2 == 1:
print "lose"
elif computer1 == 1 and computer2 == 2:
print "lose"
elif computer1 == 2 and computer2 == 0:
print "lose"
else:
print "win"
rounds = rounds + 1
Why does this give me an infinite loop? When I take out the input line and replace x with a certain value, say, 10, the output does give me 10 results. But why can't I do it with that raw_input?