title: How to break out of while loop in Python?
body: <p>I have to make this game for my comp class, and I can't figure out how how break out of this loop. See, I have to play against the "computer," by rolling bigger numbers, and seeing who has the bigger score. But I can't figure out how to "break" from my turn, and transition to the computers turn. I need "Q" (quit) to signal the beginning of the computers turn, but I don't know how to do it.</p>
  
  <pre><code>ans=(R)
  while True:
      print('Your score is so far '+str(myScore)+'.')
      print("Would you like to roll or quit?")
      ans=input("Roll...")
      if ans=='R':
          R=random.randint(1, 8)
          print("You rolled a "+str(R)+".")
          myScore=R+myScore
      if ans=='Q':
          print("Now I'll see if I can break your score...")
          break
  </code></pre>