Which module is required to be imported in a Python program to use mean,…
2023
Which module is required to be imported in a Python program to use mean, median and mode methods?
- A.
stats
- B.
statistics
- C.
standard
- D.
math
Attempted by 2253 students.
Show answer & explanation
Correct answer: B
In Python, the 'statistics' module is part of the standard library and provides functions to calculate statistical measures such as mean, median, and mode. Usage examples: Example 1: import statistics; statistics.mean([1, 2, 3]) # returns 2