Ending the game
Once we are tired of playing the game, we can answer the question Do you want to play again? Type YES or NO: with NO
. Once we do this, you will notice that game_on = False appears
in the code to stop the while
loop. As soon as the loop stops, the last line of code is executed:
This line of code prints out the scores of each player only AFTER the game loop is completed. This line of code is outside of the for
loop and the game loop. If you only ran the game once, the highest score could only be one. However, if you ran the game five or ten times, then your high scores could be as high as five or ten, depending on how many items each player guessed correctly.