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?

  1. A.

    stats

  2. B.

    statistics

  3. C.

    standard

  4. 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

Explore the full course: Rssb Senior Computer Instructor