निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of following code ?
import math
abs(math.sqrt(36)) A
Error
B
6
C
-6
D
6.0
Explanation
Let's break down the code:
import math
abs(math.sqrt(36))
Step-by-step explanation:
-
math.sqrt(36):- This calculates the square root of 36, which is
6.0. In Python,math.sqrt()always returns a float value.
- This calculates the square root of 36, which is
-
abs():- The
abs()function returns the absolute value of a number. - Since
6.0is already positive,abs(6.0)will simply return6.0.
- The
Conclusion:
The output will be 6.0.
Answer:
(D) 6.0
Correct Answer: D) 6.0