Lesson goal: For loops and the absolute value of numbers

Previous: Making math-facts tables | Home | Next: Adding numbers like Carl Gauss did

You can test how the absolute value of a number works using for-loops, by having a for-loop count over a range of positive and negative numbers and see how the absolute value comes out. Try out the code in the code-box. Reload this page if needed.

Now you try. Try constructing a for loop that will count through some negative numbers. Use print to display the absolute value of the numbers.

Type your code here:

See your results here:


Here is a share link to your code:


Here's your code:


