STEP 11: One nice thing about lines of best fit is that they allow us to predict values not shown on the scatter plot.

  • Let's make a function that takes in a student's travel time and returns his or her predicted amount of sleep.
  • In LOGIC, click on and drag in Define Function with Parameters.
  • Rename the function from my_function(my_var1, my_var2) to line(m, x, b).
  • In , drag in Multiplication indented INSIDE your new function.

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)