1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MrMuchimi
3 years ago
10

Many people keep time using a 24 hour clock (11 is 11am and 23 is 11pm, 0 is midnight). If it is currently 13 and you set your a

larm to go off in 50 hours, it will be 15 (3pm). Write a Python program to solve the general version of the above problem. Your program should first prompt the user for the time now (in hours) and for the number of hours to wait for the alarm, then store those values as type int variables time_now and wait_time respectively, and finally print the time on the 24 hour clock when the alarm will go off.
Computers and Technology
1 answer:
lozanna [386]3 years ago
6 0

Answer:

<em>The program written in Python is as follows;</em>

time_now = int(input("Time: "))

wait_time = int(input("Alarm: "))

time_now = time_now + wait_time%24

if time_now < 12:

     print(str(time_now)+"am")

else:

     time_now = time_now - 12

     print(str(time_now)+"pm")

Explanation:

This line prompts user for current time

time_now = int(input("Time: "))

This line prompts user for the alarm hours

wait_time = int(input("Alarm: "))

This line calculates the time of the alarm

time_now = time_now + wait_time%24

The following if statement determines if the time will be am or pm

If the time is less than 12, then the time will be in am

<em>if time_now < 12: </em>

<em>      print(str(time_now)+"am") </em>

If otherwise,  then the time will be in pm

<em>else: </em>

<em>      time_now = time_now - 12 </em>

<em>      print(str(time_now)+"pm")</em>

<em></em>

You might be interested in
A peripheral can be used to tell a computer to complete a specific task.<br> A) True <br> B)False
RoseWind [281]

Answer:

A. true

Explanation:

<em><u>because</u></em><em><u> </u></em><em><u>you</u></em><em><u> </u></em><em><u>can</u></em><em><u> </u></em><em><u>complete</u></em><em><u> </u></em><em><u>it</u></em><em><u> </u></em><em><u>without it</u></em><em><u> </u></em><em><u>mistakes</u></em><em><u> </u></em><em><u>if</u></em><em><u> </u></em><em><u>your</u></em><em><u> </u></em><em><u>using</u></em><em><u> </u></em><em><u>an</u></em><em><u> </u></em><em><u>computer</u></em><em><u> </u></em><em><u>but</u></em><em><u> </u></em><em><u>if</u></em><em><u> </u></em><em><u>you</u></em><em><u> </u></em><em><u>use</u></em><em><u> </u></em><em><u>an</u></em><em><u> </u></em><em><u>paper</u></em><em><u> </u></em><em><u>you</u></em><em><u> </u></em><em><u>will</u></em><em><u> </u></em><em><u>make</u></em><em><u> </u></em><em><u>mistakes</u></em><em><u> </u></em><em><u>over</u></em><em><u> </u></em><em><u>and</u></em><em><u> </u></em><em><u>over</u></em>

8 0
2 years ago
A company that designs video games has decided to expand and needs to hire Software Developers, Web Administrators, and Computer
choli [55]
Collage graduates that are currently jobless or looking to apply for a jod
8 0
3 years ago
Read 2 more answers
What is a computer?<br>please solve with explaining ​
ivann1987 [24]

Answer:

computer is a device for storing and processing data and also to communicate with people

5 0
2 years ago
Mention any four features which a standard computer laboratory should have​
Vera_Pavlovna [14]

Answer:

•Make sure doorway openings are at least 32 inches wide and doorway thresholds are no higher than 1/2 inch.

•Keep aisles wide and clear for wheelchair users.

•Make sure all levels of the lab are connected by a wheelchair-accessible route of travel.

For students with mobility impairments, make sure there are procedures in place for retrieving materials that may be inaccessible.

Make sure ramps and/or elevators are provided as an alternative to stairs. Elevators should have both auditory and visual signals for floors. Elevator buttons should be marked in large print and Braille or raised notation and easily reachable for wheelchair users.

Locate the lab near wheelchair-accessible restrooms with well-marked signs.

Service desks need to be wheelchair-accessible.

Provide ample, high-contrast, large-print directional signs throughout the lab. Mark equipment in the same fashion.

Provide study carrels, hearing protectors, or private study rooms for users who are easily distracted by noise and movement around them.

Provide at least one adjustable-height table with easily reachable controls for each type of computer.

Have wrist rests available to those who require extra wrist support while typing.

Keep document holders available to help users position documents for easy reading.

5 0
3 years ago
Read 2 more answers
A short
alexandr402 [8]

Explanation:

Java Bitwise Operators

Operator Description Example

>> (right shift) Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. A >> 2 will give 15 which is

8 0
3 years ago
Other questions:
  • When using a wireless mouse, what is the most common port used for the transmitter? 
    7·1 answer
  • Write any two use of computer in school​
    15·1 answer
  • You have been given the job of creating a new order processing system for the Yummy Fruit CompanyTM. The system reads pricing in
    8·1 answer
  • How do the companies gather data to determine common passwords?
    13·1 answer
  • Which view in the View tab of the ribbon is the easiest place to add a header or a footer? Normal view Custom Views Page Layout
    5·2 answers
  • What could have made you redesign your plan? Select 3 options.
    6·1 answer
  • Given the arra
    15·1 answer
  • In the table below, identify the data type that would be most suitable for the second field.
    10·2 answers
  • Write a static method reOrder56(int[] nums) that return an array that contains exactly the same numbers as the given array, but
    10·1 answer
  • Why do my airpods keep disconnecting from my laptop
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!