Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1statistics.median(marks) | Astatistics.stdev(marks) | |
| 2max(marks) - min(marks) | Bimport statistics print(statistics.mean(marks)) | |
| 3Make the statistics functions available before calculating the average of a list | Cmean() is called without the statistics prefix, so Python raises a NameError. Write statistics.mean(marks) after import statistics. | |
| 4Measure the spread of a sample of data using standard deviation | DThe subtraction is the wrong way round, which gives a negative range. It should be max(marks) - min(marks). | |
| 5print(mean(marks)) | EReturns the middle value of the list marks once it is sorted | |
| 6range = min(marks) - max(marks) | FCalculates the range, the gap between the highest and lowest values |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
statistics.mean(data) — The statistics module calculates descriptive statistics on a list: mean() is the average, median() the middle value, stdev() the spread. Use import statistics first.import statistics
marks = [72, 85, 90, 64]
print(statistics.mean(marks))import statistics
marks = [72, 85, 90, 64]
print(statistics.mean(marks))import statistics
ages = [15, 17, 16, 18, 16]
print(statistics.median(ages))import statistics
scores = [4, 8, 6, 5, 7]
print(statistics.stdev(scores))data = [12, 18, 9, 25, 14]
spread = max(data) - min(data)
print(spread)