Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 2: Clock Write a program named Lastname_firstname_clock.py to display a clock face with hands showing the current time. The radius of the clock face
Part 2: Clock Write a program named Lastname_firstname_clock.py to display a clock face with hands showing the current time. The radius of the clock face (the distance from the center to the hour markers) is 150. The hour hand has length 100, and the minute hand has a length of 120. You may design the clock in one of three ways: using the square cursor shape (hint: stampo ) for the hour markers and center of the clock (Figure 2a), using the square cursor shape for the hour markers and adding a circle for the face (Figure 2b), or by drawing small rectangles for the hour markers and center of the face (Figure 2c). The images are reduced in size to fit on the page better. Figure 2a Figure 2b Figure 2c To get the hour and minute, use the following code. Note that the code uses % 12 on the hour to get a number in the range 0 to 11, so both noon and midnight work out to zero. (This makes the calculations much easier, believe it or not!) import datetime hour = datetime.datetime.now().hour % 12 minute = datetime.datetime.now() .minute Things to Note Tused circle to draw the clock face. You can use it as well, or draw the circle yourself, or just a 12-sided clock face
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started