STEP 10: Now, we'll nest an if statement INSIDE our function. Make sure it's indented 8 spaces with a ········.

  • Go to and drag if or inside the function.
  • Set up the if statement to test if rand_y is equal to -150 or if rand_y is equal to 50.
  • Drag Sprite at Position inside the if statement and change its name to car.
  • Change the image name to car_img. Change its x-coordinate to -400, and and its y_coordinate to rand_y.

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)