Student lists

Report a typo

We have a dictionary called student_list that represents the enrollment of students in various subjects at a small school. In this dictionary, the keys are subject names, and the values are lists of students taking each subject.

Your task is to print the name of the most popular subject. The most popular subject is the one with the highest number of enrolled students.

For example, given the following student_list:

student_list = {
    "English": ['Tim', 'Carl', 'Dean', 'Jane'],
    "Maths": ['Jane', 'Mike', 'Ann', 'Kate', 'Nick', 'Jenny'],
    "Chemistry": ['Tim', 'Carl', 'Dean']
}

Your program should output:

Maths

since Maths has the highest number of students (6) compared to the other subjects. Note that this is a synthetic example and your code will be tested with a different student_list.

Write a program in Python 3
import operator

# write your code here
___

Create a free account to access the full topic