Can anyone tell me what does the abs () function do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone tell me what does the abs () function do?

23rd Mar 2017, 8:37 PM
Tanmay Jain
3 Answers
+ 3
People above me already answered you , but I'm gonna define what the absolute really means - It's the distance from 0 to the number you want . For example , the absolute value of -500 means what's the distance between 0 and -500 ? The distance can't be negative number because you don't say -5 meters. Think of it as a line of numbers and in center of that line you have 0 , the distance between 0 and any number you pick on that line will be the positive value of that number. So absolute value of -5 is 5 , absolute value of 263 is 263 and so on . Hope I helped you :)
23rd Mar 2017, 9:49 PM
Tornike Shelia
Tornike Shelia - avatar
+ 2
it returns absolute value of number between the brackets. examples: abs(12)=12 abs(-54)=54
23rd Mar 2017, 8:52 PM
emin subasic
+ 2
returns the absolute value of a number. Example: >>>abs(8) 8 >>>abs(-23) 23
23rd Mar 2017, 8:52 PM
Ricardo Astudillo