EXERCISE 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 for loop to draw the six stars.
  • The value of the variables x and size should change inside the loop.

Remember, your code should draw the exact same star. 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)