num = -4.5
abs_num = abs(num)
print(f"The absolute value of {num} is {abs_num}")
The absolute value of -4.5 is 4.5
abs()
` function to calculate the absolute value of the variable `num
`. abs_num
` will be `4.5
` in this case. We then use an f-string to print out the original number and its absolute value.