Exemple #1
0
#LESSON SIX ASSIGNMENT

#Write a short Python program that creates a Time object and works with some of the functions.

from L6_ass_class import Time

myTime1 = Time()
myTime1.print_time()
myTime1.set_time(1, 2, 3)

myTime2 = Time()
myTime2.set_second(5)
myTime2.set_minute(59)

breakEverything = Time()
breakEverything.set_second(60)
breakEverything.set_minute(60)
breakEverything.set_hour(24)
breakEverything.get_second()
breakEverything.get_minute()
breakEverything.get_hour()

#LESSON SIX ASSIGNMENT

#Inside this program, you might consider writing a loop and placing a call to the tick function to watch your time move forward.

from L6_ass_class import Time

myTime = Time()

while 1 == 1:
    myTime.tick()

    if myTime.get_hour() == 1:
        break
    
    myTime.print_time() 

print "It's over."
print "It's done."
Exemple #3
0
#LESSON SIX ASSIGNMENT

#Inside this program, you might consider writing a loop and placing a call to the tick function to watch your time move forward.

from L6_ass_class import Time

myTime = Time()

while 1 == 1:
    myTime.tick()

    if myTime.get_hour() == 1:
        break

    myTime.print_time()

print "It's over."
print "It's done."