STEP 1: Let’s write a single function that can do the work of both functions by using more parameters!

  • At the top of the program, create a function named get_new_weight() with the parameters image_label, earth_weight, gravity.
  • Use Set Background indented inside the function with the parameter image_label.
  • On the next line in the function calculate new_weight by multiplying earth_weight * gravity.

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)