STEP 8: To stop this loop, the value of choice needs to be "no". Let's get that value with user input!

  • Go to GRAPHICS and . Drag Stage Ask in the while loop after this code: stage.wait(1)
  • Click Run and answer the question. What happens when you answer yes? What about apple?
  • Click Run and answer no. What happens? The loop condition is False when choice is "no".
  • Our loop is no longer infinite! Find and delete this line of code: ····print("Infinite·loop!")¬

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)