0

What does "math.abs" do?

22nd Mar 2018, 2:42 PM
Braa_G
Braa_G - avatar
3 Respostas
+ 5
If you're still unsure: In mathematics, the absolute value of a number is defined as: |x| = if x < 0: (-1)*x if x >= 0: x So, if the number is negative multiply it by -1. Otherwise, leave it as is.
22nd Mar 2018, 3:56 PM
Rrestoring faith
Rrestoring faith - avatar
+ 3
And going deeper, absolute value of a number is a distance from zero to that number. So it's always positive.
22nd Mar 2018, 3:58 PM
Шишов Михаил
Шишов Михаил - avatar
+ 2
Returns absolute value of a number. abs(5)=5; abs(-5)=5
22nd Mar 2018, 2:51 PM
Шишов Михаил
Шишов Михаил - avatar