TORONTO KIDS COMPUTER CLUB | Monday 20:00 Python Practice 20.10.26.
18521

# Monday 20:00 Python Practice 20.10.26.

## 28 Oct Monday 20:00 Python Practice 20.10.26.

Question:
Create a Time class and initialize it with hours and minutes.

• Make a method addTime which should take two time object and add them. E.g.- (2 hour and 50 min)+(1 hr and 20 min) is (4 hr and 10 min)
• Make a method displayTime which should print the time.
• Make a method DisplayMinute which should display the total minutes in the Time. E.g.- (1 hr 2 min) should display 62 minute.

• ##### Jesse Shi
Posted at 01:12h, 31 October Reply

class Time(hours=0, minutes=0):
global h
h = 60
total = hours * 1 + minutes * 60
h = m * 60

h = int(input(‘How many hours do you have to play video games?’))
m = int(input(‘How many minutes do you have left to play video games?’))
print(‘Oh, all you got is’, m + h, ‘???’)

print(‘{} hours, {} minutes’.format(h, m))

time = Time(hours = h, minutes = m)
print(‘The gaming time is only {:.2f}?’.format(time))
print(‘All you got is’, h * 60 + m, ‘minutes!!!’)

I don’t think those are really correct… Though I know what you mean, and the hours was not defined…