, , . , , , python. , .
- , . , clock, .
class Clock:
class_hours = 12
.
- , , . , clock Class, , ( , , ):
class Clock:
class_hours = 12
def __init__(self, hours):
if (hours <= class_hours):
self.hours = hours
, if , , , . , , , .
- , , , . clock, , , :
class Clock:
class_hours = 12
class_minutes = 60
class_seconds = 60
def __init__(self, hours, minutes, seconds):
self.hours = hours
self.minutes = minutes
self.seconds = seconds
def setTime(new_hour, new_minute, new_second):
self.hours = new_hour
self.minutes = new_minute
self.seconds = new_second
clock, - . , clock.setTime(11,49,36) 11:49:36.
I hope this was helpful and as clear as possible to you. If I were ambiguous or ignored any terminology that you do not understand, let me know so that I can update my answer in order to be as clear as possible.
source
share