Question: Python3 Skills Needed to complete this Lab (You may not use all of these skills) . Create and use classes Clock We'll use our skills
Skills Needed to complete this Lab (You may not use all of these skills) . Create and use classes Clock We'll use our skills to create a clock class that can keep track of hours, minutes and seconds. The you should be able to create an instance with values for hour, minutes and seconds. want to make a new class with a_ini method. You'll want to set the attributes for hour, minute, and second in the init. You'll Sample Output Creating an instance of Clock test >>> clock-Clock (2, 10, 15) >>> clock.hour >>> clock.minute 10 >>>clock.second 15 str method Create a string override method so that the hour, minute, seconds output with a nice 24 hour format style. It should output as 02:10:15 for the example above. In order to output leading zeros you can use .format like below. Sample Output str method test >>> print(clock) 02:10:15 >>> clock . hour 0 >>> print(clock) 00:10:15 >"(:02)".format(1) 01
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
