Sha256: 83415290e49e7bce1859652fd839e71de5fdb2f1696db0f7124d4c208214fc49

Contents?: true

Size: 587 Bytes

Versions: 37

Compression:

Stored size: 587 Bytes

Contents

class Clock(object):
    'Clock that displays 24 hour clock that rollsover properly'

    def __init__(self, hour, minute):
        self.hour = hour
        self.minute = minute
        self.cleanup()

    def __repr__(self):
        return "{:02d}:{:02d}".format(self.hour, self.minute)

    def __eq__(self, other):
        return repr(self) == repr(other)

    def __add__(self, minutes):
        self.minute += minutes
        return self.cleanup()

    def cleanup(self):
        self.hour += self.minute // 60
        self.hour %= 24
        self.minute %= 60
        return self

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
trackler-2.2.1.107 tracks/python/exercises/clock/example.py
trackler-2.2.1.106 tracks/python/exercises/clock/example.py
trackler-2.2.1.105 tracks/python/exercises/clock/example.py
trackler-2.2.1.104 tracks/python/exercises/clock/example.py
trackler-2.2.1.103 tracks/python/exercises/clock/example.py
trackler-2.2.1.102 tracks/python/exercises/clock/example.py
trackler-2.2.1.101 tracks/python/exercises/clock/example.py
trackler-2.2.1.100 tracks/python/exercises/clock/example.py
trackler-2.2.1.99 tracks/python/exercises/clock/example.py
trackler-2.2.1.98 tracks/python/exercises/clock/example.py
trackler-2.2.1.97 tracks/python/exercises/clock/example.py
trackler-2.2.1.96 tracks/python/exercises/clock/example.py
trackler-2.2.1.95 tracks/python/exercises/clock/example.py
trackler-2.2.1.94 tracks/python/exercises/clock/example.py
trackler-2.2.1.93 tracks/python/exercises/clock/example.py
trackler-2.2.1.92 tracks/python/exercises/clock/example.py
trackler-2.2.1.91 tracks/python/exercises/clock/example.py
trackler-2.2.1.90 tracks/python/exercises/clock/example.py
trackler-2.2.1.89 tracks/python/exercises/clock/example.py
trackler-2.2.1.88 tracks/python/exercises/clock/example.py