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
nikdorinn [45]
3 years ago
5

Write a program that converts a time in 12-hour format to 24-hour format. The program will prompt the user to enter a time in HH

:MM:SS AM/PM form. (The time must be entered exactly in this format all on one line.) It will then convert the time to 24 hour form. You may use a string type to read in the entire time at once, including the space before AM/PM, or you may choose to use separate variables for the hours, minutes, seconds and AM/PM.
Computers and Technology
1 answer:
podryga [215]3 years ago
8 0

Answer:

This program is written in Python

inputtime = input("HH:MM:SS AM/PM: ")

splittime = inputtime.split(":")

secondAM = splittime[2].split()

if secondAM[1] == "AM":

   print(splittime[0]+":"+splittime[1]+":"+secondAM[0])

elif secondAM[1] == "PM":

   HH = int(splittime[0])

   HH = HH + 12

   print(str(HH)+":"+splittime[1]+":"+secondAM[0])

   

Explanation:

This line prompts user for input

inputtime = input("HH:MM:SS AM/PM: ")

This line splits the input string to HH, MM and "SS AM/PM"

splittime = inputtime.split(":")

This line splits "SS AM/PM" to SS and AM/PM

secondAM = splittime[2].split()

This line checks if time is AM

if secondAM[1] == "AM":

This line prints the equivalent time

   print(splittime[0]+":"+splittime[1]+":"+secondAM[0])

Else;

elif secondAM[1] == "PM":

The equivalent 24 hour is calculated

   HH = int(splittime[0]) + 12

This line prints the equivalent time

   print(str(HH)+":"+splittime[1]+":"+secondAM[0])

You might be interested in
Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
Kazeer [188]

Answer:

2^7= 128

Explanation:

An instruction format characterizes the diverse part of a guidance. The fundamental segments of an instruction are opcode and operands. Here are the various terms identified with guidance design:  Instruction set size tells the absolute number of guidelines characterized in the processor.  Opcode size is the quantity of bits involved by the opcode which is determined by taking log of guidance set size.  Operand size is the quantity of bits involved by the operand.  Guidance size is determined as total of bits involved by opcode and operands.

6 0
4 years ago
How do you optimize a website using JavaScript?
GenaCL600 [577]
You can edit the website (using Wordpress) -if it is your website of course-, and code JavaScript commands into the page that’s going to be uploaded.

Check out my website: www.birdbloggersblog.com

I coded that with HTML.
4 0
3 years ago
Suppose that a t-shirt comes in five sizes: S, M, L, XL, XXL. Each size comes in four colors. How many possible t-shirts are the
guapka [62]

Answer:

120

Explanation:

This question is basically asking how many ways can we arrange 5 sizes of shirts if they come in 4 colors.

5 permutation of 4

To find permutation, we use the formula

P(n, r) = n! / (n - r)!

Where

n is the size of the shirts available, 5

r is the color of each shirt available, 4

P(5, 4) = 5! / (5 - 4)!

P(5, 4) = (5 * 4 * 3 * 2 * 1) / 1!

P(5, 4) = 120 / 1

P(5, 4) = 120

Therefore, the total number of shirts available is 120

3 0
3 years ago
Megan was employed by a large company. Her supervisor told her to falsify government reports. She refused and was fired. She sue
Ber [7]

Answer: Option(d) is correct option

Explanation:

At-will employment is the employment in contractual manner in which employer can fire employee without any warning or indication .They can fire employee for any cause .

  • According to the question, even though Megan was hired at at-will employment base ,she does not persist much right over the company but she should not be dismissed for not performing illegal act as the reason for getting fired.This is a unfair and illegal manner of firing.
  • Other options are incorrect because employer was not correct on firing her because of loyalty duty or based on legal right or with just reason.Thus, the correct option is option(d)
7 0
4 years ago
What type of laptop display technology provides fast refresh rates with relatively little power and does not require a backlight
saveliy_v [14]

Answer:

LCD

Explanation:

Liquid Crystal Display

3 0
3 years ago
Other questions:
  • Which of the following software programs provides for e-mail communication?. A. Access. B. Word Perfect. C. Outlook. D. Excel
    15·2 answers
  • How can these requirements be met? Universal Containers conduct evaluations of their sales reps using a custom object consisting
    10·1 answer
  • As a ______________ you must be able to show that you know what to do to keep food safe
    15·1 answer
  • Please Help ASAP!!
    11·2 answers
  • What is top down design? a. Top down design is a way of designing your program by starting with the biggest problem and breaking
    7·1 answer
  • After adjusting your seat, your _____ should be as close as possible to the backrest
    7·2 answers
  • Which of the following is true regarding data analysis? a. Disciplines and professions do not provide guidance on data analysis.
    6·2 answers
  • so i just went to play forge of empires and when i logged on to it all of my progress was gone and i was so far in to it
    15·2 answers
  • In this exercise you will debug the code which has been provided in the starter file. The code is intended to do the following:
    8·1 answer
  • UPS or FedEx plays what role in the supply?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!