Sha256: 99385df89a05e959d3fd887bf6e0dee90ce46294b0e512ba823ea213cde0038e
Contents?: true
Size: 419 Bytes
Versions: 396
Compression:
Stored size: 419 Bytes
Contents
from collections import defaultdict class School(object): def __init__(self, name): self.name = name self.db = defaultdict(set) def add(self, student, grade): self.db[grade].add(student) def grade(self, level): return self.db[level] def sort(self): return sorted((grade, tuple(sorted(students))) for grade, students in self.db.items())
Version data entries
396 entries across 396 versions & 1 rubygems