mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-06 15:15:01 -06:00
fix clock
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
class Clock(object):
|
||||
def __init__(self, hour, minute):
|
||||
self.hour, self.minute = hour, minute
|
||||
self.change(0)
|
||||
|
||||
def __repr__(self):
|
||||
return '<Clock {}:{}>'.format(str(self.hour).zfill(2), str(self.minute).zfill(2))
|
||||
return '{}:{}'.format(str(self.hour).zfill(2), str(self.minute).zfill(2))
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.hour == other.hour and self.minute == other.minute
|
||||
@@ -18,6 +19,7 @@ class Clock(object):
|
||||
self.hour -= 1
|
||||
self.minute += 60
|
||||
self.hour = self.hour % 24
|
||||
return self.__repr__()
|
||||
|
||||
def __add__(self, minutes):
|
||||
return self.change(minutes)
|
||||
|
||||
Reference in New Issue
Block a user