Calculate the Absolute Value (Solution)
Okay. The first instruction is virtually identical to the one from the previous exercise, so this one should be fairly easy. You define a variable called
num and assign a floating-point number obtained from the user. So, enter a number.
and here inside the second pair of curly brackets, you can write
abs(), which is short for absolute value, and you pass your number. Now, let’s save and reload it. Let’s enter
-10, as in the example. Great.
Become a Member to join the conversation.