Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- courses, nl, command = {}, '\n-- ', input()
- while True:
- if command == "end":
- break
- course, student = command.split(" : ")
- if course not in courses:
- courses[course] = []
- courses[course].append(student)
- command = input()
- [print(f"{k}: {len(v)}\n-- {nl.join(sorted(v))}")
- for k, v in {k: v for k, v in sorted(courses.items(), key=lambda x: -len(x[1]))}.items()]
Add Comment
Please, Sign In to add comment