Diffrence abs()
and round()
function in PYTHON
abs()
function takes only one argument. In argument it basically takes number (for example integer and float). For complex number it returns the magnitude (for example : 3i+4j : √ (3)² + (4)² = 5).
Other Examples are :
var = 65.6
print ( var)
OUTPUT: 65
round()
function can take two arguments. The first argument is the number which round-off value will be printed. The second argument is optional, tells up to which the given number (First argument) is rounded.
For Example :
print(round(51.6))
print(round(51.4))
print(round(2.665, 2))
OUTPUT :
52
51
2.67
NOTE: Both functions will give type error if the argument is not numbers.
Top comments (0)