A function that summarizes a satisfaction survey
Fill in the blanks · Medium · §8.3, §8.4 Returning several values
The function takes a list of satisfaction scores and returns two values together: the number of responses at or above the cutoff, and the average. The default cutoff is 70 points, and the second call changes the cutoff to 85 points. Write Blank 3 as a keyword argument.
Code with blanks
def summary(scores, cutoff=____):
passed = 0
for s in scores:
if s >= cutoff:
passed += 1
avg = sum(scores) / len(scores)
return ____
data = [72, 85, 90, 64]
count, avg = summary(data)
print(count, avg)
count, avg = summary(data, ____)
print(count)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.