STEP 8: Now let's use random choice to randomly pick a value from a list. First, we'll have to customize our list.

  • Change the list name to img_list.
  • Change the values of img_list to ["car1", "car2"].
  • Change the name of the random variable to car_img.
  • Change the parameter in random.choice() to img_list.

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)