Step 2: The code that creates this drawing is inefficient. We wrote the exact same commands SIX times!

  • Refactor the code so that it uses a Loop with Range (for loop) to draw the six stars.
  • The value of the variables x and size should change inside the loop.
  • Think: How do the values of x and size change in the program? (Hint: check the lines after creating a star)

Remember, your code should draw the exact same stars. You should delete or comment out the original code.

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)