A function that returns the total and the maximum together

Write code · Medium · §7.3, §8.4 Returning several values

Write a function summarize(nums) that takes a list of numbers and returns the total and the maximum together as one tuple. The code below unpacks the two returned values into total and biggest and prints them, and it computes the average outside the function. You may use sum() and max().

Starter code

comments = [3, 0, 12, 5, 0, 8]
# Write the summarize function here

total, biggest = summarize(comments)
print(total, biggest)
print(f"{total / len(comments):.1f}")
print(summarize(comments))

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.