I'm trying to write a boolean function that takes two Mytime objects, t1 and t2 as arguments, and returns True if the object falls inbetween the two times.
This is a question from the How to Think Like a Computer Scientist book, and I need help.
What I've gotten so far:
class MyTime:
def __init__(self, hrs=0, mins=0, secs=0):
self.hours = hrs
self.minutes = mins
self.seconds = secs
def between(t1, t2):
if t1 <= t2:
return True
else:
return False
I just don't understand how to make a function that uses MyTime objects into the boolean function? Any help would be great.