I am reading the book "How to think like a computer scientist" by Allen Downey, Jeffrey Elkner and Chris Meyers. When I read chapter 13 I typed the code from the book into the interpreter: time = Time () time.hours = 11 time.minutes = 59 time.seconds = 30 And then I typed: print Time I got the following system output: >>> print Time __main__.Time Then I tried: print time And the system output was this: >>> print time <__main__.Time instance at 0x17635d0> Can somebody explain to me what's going on? Thank you!
I forgot to mention, of cause, that I created a class by typing the following in the very beginning: class Time(): pass Everything else in my initial message followed.
I figured it out! "print time" prints the instance; whereas "print Time" prints the class nice
Join our real-time social learning platform and learn together with your friends!