I'm working on a problem from "How To Think Like A
Computer Scientist".  I created  a Time class:

class Time:
        
        def __init__(self, hours, minutes, seconds):
                self.hours = hours
                self.minutes = minutes
                self.seconds = seconds

I created a function to print the Time object:

def printTime(time):
        print "%d:%d:%d" % (time.hours, time.minutes,
time.seconds)
                
However, when I type '00', I get the following:
>>> time = Time(12,34.4,00)
>>> printTime(time)
12:34:0
>>> time.seconds
0

How do I get around this problem?  I know there is a
time module.  However, I think that is overkill for
this particular assignment.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to