Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

=+23. Advertising strategies EVPI.

Answered: 1 week ago