Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+5 votes

In part 4 of lab 9, I am a little confused on what the first parameter means when we need to call function printTopN? Could someone help me understand what needs to be passed in as that parameter when calling that function?

asked in CSC201 Spring 2021 by (756 points)

2 Answers

+2 votes

In part 4, you have to create a new dictionary that has the keys, which are the company names, and the values are the number of complaints that each company has.

After that, you have to call the printTopN function, which accepts the first parameter as the new dict that you has just created, and the second parameter as the number of companies that the user input.

answered by (2.8k points)

how to have company names as key and the number of complaints as values in the newdict ?

+1 vote

To add a little more to T.K.'s answer, you probably want to go back and review the slides from

Day32-More Dictionaries and Functions

Look for the part about "Counts of Majors", where we did a similar task, involving counting how many students had each major.

(If you want to re-watch the class video where we code that part in Thonny and discuss the code in more detail, the MP4 file is attached to your Google Calendar event from last Wednesday (4/28).

answered by (14.2k points)