CBSE Class 11 Computer Science Question 21 of 63

Introduction to Python Modules — Question 2

Back to all questions
2
Question

Question 2

What will be the output on screen after executing: print(math.fabs(-6.4)) ?

  1. -6.4
  2. 6.4
  3. 4
  4. 6
Answer

6.4

Reason — The math.fabs() function returns the absolute value of a number. For math.fabs(-6.4), it returns 6.4, which is the positive magnitude of the number.