Pure Programmer
Blue Matrix


Cluster Map

Project: Absolute Value

Write a program to compute [[Absolute_value|absolute values]]. The absolute value of a number |x| is x if x is positive and -x if x is negative.

Output
$ python3 AbsoluteValue.py |5| = 5 |-3| = 3 |0| = 0 |3.140000| = 3.140000 |-1.200000| = 1.200000 |0.000000| = 0.000000

Solution