STEP 5: It is time to create a loop that will run our game until the user chooses to stop.

while loops repeat code potentially infinitely and stop only when a defined condition becomes False.

  • Go to and drag While Not Equals to the bottom of your program.
  • Change the comparison variable in the while loop condition from my_var to choice.
  • Click the Console to see that the loop is still running. Click Stop before submitting!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)