fix clock

This commit is contained in:
Xevion
2019-07-13 22:17:17 -05:00
parent 840a16f8e0
commit ed5a61fe19

View File

@@ -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)