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:
from statistics import mean, mode
Data=[4,4,1,2,4]
print(mean(Data), mode(data))
- A.
1 4 / 1 4
- B.
4 1 / 4 1
- C.
3 4 / 3 4
- D.
4 3 / 4 3
Attempted by 1694 students.
Show answer & explanation
Correct answer: C
Compute the mean and mode of Data = [4, 4, 1, 2, 4].
Step 1: Mean calculation - Sum = 4 + 4 + 1 + 2 + 4 = 15, number of elements = 5, so mean = 15 / 5 = 3.
Step 2: Mode determination - Count frequencies: 4 appears 3 times, 1 appears once, 2 appears once. The mode is 4 (most frequent).
Printed output: 3 4