KnowledgeBoat Logo
|
LoginJOIN NOW

Computer Science

What will be the output of the function given below?

>>import math
>>abs(math.sqrt(25))
  1. Error
  2. 5
  3. -5
  4. 5.0

Python Libraries

2 Likes

Answer

5.0

Reason — The given code calculates the square root of 25 using the math.sqrt() function from the math module, resulting in 5.0 since sqrt() returns a floating-point number. Applying abs() to a positive number like 5.0 doesn't alter the value, thus the final output remains 5.0.

Answered By

2 Likes


Related Questions