Assuming all required modules have already been imported, identify the correct…
2023
Assuming all required modules have already been imported, identify the correct output of the following Python program segment: Data=[4, 4, 1, 2, 4] print(mean(Data), mode(data))
- A.
1 4
- B.
4 1
- C.
3 4
- D.
4 3
Attempted by 1553 students.
Show answer & explanation
Correct answer: C
3.0 4
Explanation:
Mean = (4 + 4 + 1 + 2 + 4) / 5 = 15 / 5 = 3.0. The statistics.mean function returns a float, so the printed mean appears as 3.0.
Mode = 4 (4 appears three times, more than any other value).
Note: Make sure the same variable name is used in both calls (Data) and that the statistics module (or relevant functions) are imported before calling mean and mode.