I am currently working on the following project:
Write a PYTHON function that takes the time as three integer arguments (for hours, minutes, and seconds), and returns the number of seconds since the last time the clock “struck 12.” Use this function to calculate the amount of time in seconds between two times, both of which are within on 12-hour cycle of the clock.
Here is what I have done so far:
class Time: def after(self, time2): "Return true if this time after time2." return self.convertToSeconds() > time2.convertToSeconds() def convertToSeconds(self): "Convert time to seconds." return self.hours * 3600 + self.minutes * 60 + self.seconds def increment(self, seconds): "Increment time by seconds." self.seconds += seconds self.reduceTime() def reduceTime(self): while self.seconds >= 60: self.seconds -= 60 self.minutes += 1 while self.minutes >= 60: self.minutes -= 60 self.hours += 1 def showTime(self): "Display time in 24-hour format." print "%02d:%02d:%02d" % (self.hours, self.minutes, self.seconds)
NOW, I'm stuck and I have no idea how to continue with the code. Can anybody please help me with this project?Any help would be greatly appreciated!!! thanks a lot!!!