I'm making a rock paper scissors game in python from a tutorial book. I think I'm following the book to the letter but for some reason this 'break' statement isn't working.
while True: # Main game loop
print('%s Wins, %s Losses, %s Ties' %(wins,losses,ties))
while True: # Player input loop
print('Enter your move: (r)ock (p)aper (s)cissors or (q)uit')
playerMove = input()
if playerMove== 'q':
sys.exit() # Quit the program
if playerMove == 'r' or playerMove =='p' or playerMove =='s':
print('at least this is working')
break # Break out of player input loop
print('but this is not')
# Display player move
if playerMove == 'r':
print('ROCK versus...')
elif playerMove == 'p':
The code goes on but this is all that is relevant for this problem. When I run it it shows up like this
ROCK,PAPER,SCISSORS
0 Wins, 0 Losses, 0 Ties
Enter your move: (r)ock (p)aper (s)cissors or (q)uit
r
at least this is working
0 Wins, 0 Losses, 0 Ties
Enter your move: (r)ock (p)aper (s)cissors or (q)uit
The 'q' for quit option works just fine so it's clearly getting the input. Apart from that it just keeps repeating the loop. As you can see I put some text in there just to experiment and show where things are breaking down.
What am I doing wrong here?