Question: Python : suppose you have an analog clock: if the small hand is pointing to 1 2 , write a program that prints the number

Python : suppose you have an analog clock:
if the small hand is pointing to 12, write a program that prints the number the small hand is going to be pointing at (newHours) after a number of hours stored in variable n.
For example: after 1 hour the small hand points to 1.
after 11 hours the small hand points to 11.
after 12 hours the small hand points to 12 again.
after 13 hours the small hand points to 1.
after 24 hours the small hand points to 12.
after 30 hours the small hand points to 6.
etc.
% python3 prog05.py
how many hours later: 13
1
% python3 prog05.py
how many hours later: 24
12
% python3 prog05.py
how many hours later: 30
6
% python3 prog05.py
how many hours later: 12
12
%
put the code in a file called prog05.py
use the following code as a starter. You only need to write one line of code.
n = int(input("how many hours later: "))
#your code starts here:
#your code ends here
if newHours ==0:
newHours =12
print(newHours)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!