STEP 4: Let's name our function!

Give functions names related to what they will do. This makes your code easier to read and use.

  • Go to and drag out Define Function. Drop it at the bottom of your program.
  • Change the name of the function from my_function to bridge_scene.
  • Drop the Drawbridge background INSIDE your function. Indent it 4 spaces under the def line.

Just like loops and conditionals, a function will cause an error if it is empty.

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)