OOP with MyTime

Chris Angelico rosuav at gmail.com
Thu Jul 3 15:01:09 CEST 2014

On Thu, Jul 3, 2014 at 10:51 PM,  <kjakupak at gmail.com> wrote:
> So I've now gotten this:
> class MyTime:
>     def between(self, t1, t2):
>         return (t1.hours, t1.minutes, t1.seconds) <= (self.hours, self.minutes, self.seconds) and (self.hours, self.minutes, self.seconds) <= (t2.hours, t2.minutes, t2.seconds)
> print("between(t2, t3, t1) =", between(t2, t3, t1))

And what happens when you run this code? A NameError, I would expect.
Do you understand how to define and call methods?


More information about the Python-list mailing list