STEP 17: We're ready to write to our file. Doing so is as easy as just using two toolkit blocks!

csv.writer(my_file) creates an object that can write to a specific CSV file.

  • In SUBJECT and , drag Create Writer inside update_high_scores().
  • Then, drag Write Row to CSV underneath and inside update_high_scores().
  • Finally, let's close our file! Drag Close File underneath your for loop. It should be indented only 4 spaces.

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)