The sports day sign-up sheet is a list of [name, class] pairs. Write group_by_class(students) to return a dict of class to a list of its names, with classes and names in the order they appear on the sheet. An empty sheet gives {}.
group_by_class([["Ann", "3A"], ["Bo", "3B"], ["Cy", "3A"]])→{'3A': ['Ann', 'Cy'], '3B': ['Bo']}group_by_class([["Dee", "4C"]])→{'4C': ['Dee']}def group_by_class(students):
groups = {}
for name, cls in students:
# your code here: a new class gets an empty list,
# then add the name to it
pass
return groups
Run tries the examples. When they look right, Submit.