Correct option is B
To use the
mean,
median, and
mode methods in Python, you need to import the
statistics module. This module provides functions to calculate various statistical operations like mean, median, mode, variance, and standard deviation.
Important Key Points:
1.
statistics Module: This module is specifically designed to provide mathematical statistics functions.
2.
Functions Available:
·
mean(): Calculates the average of a list of numbers.
·
median(): Finds the middle value in a sorted list of numbers.
·
mode(): Returns the most common value in a list of numbers.
3.
Easy Access: To use these functions, you simply import the statistics module as follows: import statistics.
4.
Alternative for Numerical Operations: For more complex numerical computations, you might also consider using libraries like NumPy or SciPy.
Knowledge Booster:
·
Option (a): There is no
stats module in Python’s standard library. However,
scipy.stats in the SciPy library provides statistical functions but isn't the correct answer for the standard library.
·
Option (c): There is no
standard module in Python.
·
Option (d): The
math module provides mathematical functions like sqrt(), sin(), cos(), but it does not include methods for statistical operations like mean, median, or mode.