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
1. Accessing calendars, contact information, emails, files and folders, instant messages, presentation, and task lists over the
Veseljchak [2.6K]
1. Cloud Computing
2. Web Conferencing
3. Ribbon
4. PowerPoint
5. Sadie should share the document in One Drive and give her sister permission to edit the document
6. The design and arrangement of items for efficiency and safety
6 0
3 years ago
PLEASEEEE HELPPP
zavuch27 [327]
<span>C. real-time operating system</span>
6 0
3 years ago
Which two cisco products are equipped with the integrated connector to the cisco cws service? (choose two. )
jeka94

The cisco products that are equipped with the integrated connector to the cisco cws service include Cisco ESA and Cisco WSA.

<h3>What is an integrated connector?</h3>

It should be noted that an integrated connector are the components that are offered to connect with applications and data sources.

In this case, the cisco products that are equipped with the integrated connector to the cisco cws service include Cisco ESA and Cisco WSA.

Learn more about integrated connection on:

brainly.com/question/24196479

#SPJ12

8 0
2 years ago
Uses of keyboard as a input device
KATRIN_1 [288]

helps us for typing letters, numbers and symbols etc.

3 0
3 years ago
Read 2 more answers
Select one or more of the following: Which of these events will cause signal(s) to be generated by the kernel (the operating sys
nikitadnepr [17]

Answer:

a. The process has done something wrong (segmentation fault, etc.)

Explanation:

Events that cause signals to be generated by kernel and sent to childless foreground process is the process has done something wrong(segmentation fault), as Hardware exceptions generate signals,for example, divide by 0 or invalid memory reference. These conditions are usually detected by the hardware, and the kernel is notified. The kernel then generates the appropriate signal for the process that was running at the time the condition occurred.

7 0
3 years ago
Other questions:
  • In the 21st century organization we will see:
    10·1 answer
  • Using the expected format, of putting key information where the reader can’t find it, is an example of?
    8·2 answers
  • Write code to print the location of any alphabetic character in the 2-character string passCode. Each alphabetic character detec
    10·1 answer
  • A __________ is a combination of software and hardware that links two different types of networks.
    14·1 answer
  • Which feature of a word processing program enables you to represent an text information in the form of a diagram?
    14·2 answers
  • Suppose for the worst case, given input size n: Algorithm 1 performs f(n) = n2 + n/2 steps Algorithm 2 performs f(n) = 12n + 500
    6·1 answer
  • hi Let's say you graduate from school and you are unemployed or take a low-paying job. What are your debt repayment options if y
    8·2 answers
  • )In a graph represented by adjacency matrix u can find all the neighbours of a given vertices in ____Operations
    6·1 answer
  • The base position for your fingers to be placed on a keyboard is called<br> 2 point
    15·2 answers
  • when inputting a formula into excel or other spreadsheet software, what components are required for the formula to function prop
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!