Lesson goal: For loops and plotting the absolute value

Previous: Graph a line in slope-intercept form | Home | Next: Graph a parabola

Once you learn about absolute values, you may have to make plots of them. They often result in strange "V-shaped" plots. You can learn how to plot absolute value functions here.

Now you try. Try fixing the pset statement to plot the variable $x$ on the x-axis and $|x|$ on the y-axis.

Type your code here:


See your results here:

This code will not run. You have to fill in the y= line to be assigned to the absolute value of x, then fix the pset statement first. Fix it to plot $x$ on the x-axis, and the $|x|$ on the y-axis. Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.