?
Which built-in function is used to calculate the absolute value of a number?
Answer & Solution
Correct Answer:
Option
A
The correct answer is Option A: abs().
The abs() function in Python is used to calculate the absolute value of a number.
It returns the magnitude of a numeric value without regard to its sign.
For example:
The abs() function in Python is used to calculate the absolute value of a number.
It returns the magnitude of a numeric value without regard to its sign.
For example:
print(abs(-5)) # Output: 5
print(abs(3.14)) # Output: 3.14
Join the Discussion
Login to post a comment or share your explanation.
Login