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

Version Path
trackler-2.2.1.180 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.179 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.178 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.177 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.176 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.175 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.174 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.173 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.172 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.171 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.170 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.169 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.167 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.166 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.165 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.164 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.163 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.162 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.161 tracks/python/exercises/grade-school/example.py
trackler-2.2.1.160 tracks/python/exercises/grade-school/example.py