STEP 9: We also want the program to pick a random road based on it's y-coordinate.

We have 4 roads with unique y-values. When the function runs, we want a car to appear on one of the roads.

  • Create a List of Integers in the function named road_list with the values [-150, -50, 50, 150].
  • Drag another Random Choice inside the function and name it rand_y.
  • Change the parameter in random.choice() to road_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)