How to break out of while loop in Python?
A couple of changes mean that only an R or r will roll. Any other character will quit import random while True: print(‘Your score so far is {}.’.format(myScore)) print(“Would you like to roll or quit?”) ans = input(“Roll…”) if ans.lower() == ‘r’: R = np.random.randint(1, 8) print(“You rolled a {}.”.format(R)) myScore = R + myScore … Read more