I am writing a "clean" method for a "Time" class. The clean method would take a Time object and would make sure that the number of seconds and minutes is between 0 and 59. I am running into an error with recursion. Here is what I have so far:
def clean(self):
'''Adjust Time object so that the number of seconds and minutes
is between 0 and 59'''
if self.S < 60:
self.S
else:
self.M = int(self.S/60)+self.M
self.S = self.S%60
if self.M < 60:
self.M
else:
self.H = int(self.M/60)+ self.H
self.M = self.M%60
if isinstance(self.H,float) == True:
self.S = self.H * 3600
self.clean()
else:
self.H
return self.__str__()
if self.S < 60: self.Sis dead code. Same for the other if statement.