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
In what type of attack does the attacker send unauthorized commands directly to a database?
Delvig [45]
SQL injection. This is usually cause by the programmer not making the program parse incoming text, therefore allowing an attacker to input database commands.
4 0
4 years ago
(1)similarities between backspace key and delete key. (2) different between backspace key and delete key. (3) explain the term e
vovangra [49]

Answer:

1.similarity:

  • they are both editing keys

3.ergonomics are designed keying devices that alleviates wrist strain experienced when using ordinary keyboard for long hours

4.

  • .<em>a</em><em> </em><em>click</em> is pressing and releasing the left mouse button once
  • <em>right </em><em>click</em> is pressing the right mouse button once to display a short cut menu with commands from which a user can make a selection
  • <em>double </em><em>click</em> is pressing the left button twice in rapid succession
  • <em>drag </em><em>and </em><em>drop</em> is where by the user drags an icon or item from one location on the screen to another.

3 0
3 years ago
Mario kart is mercedes lol
anyanavicka [17]

Answer:

facts xD

Explanation:

6 0
3 years ago
Read 2 more answers
Which location on the ribbon contains the commands for adding a table to a document?
Maksim231197 [3]

Adding a table to a document can be done in Microsoft Word using the insert ribbon, the insert ribbon are mostly used for adding options to a document.

  • The insert ribbon is a multi functional ribbon which has up to about 10 different useful groups for adding elements to a document.

  • Some of the groups on the insert ribbon include ; Pages, Text, Header & Footer, Tables, illustrations, Links, Media and so on.

  • The Table group in the insert ribbon allows different table adding options such as inserting an already existing table, drawing a new table or importing an excel table.

Therefore, adding a table to a document is performed from the insert ribbon in Microsoft Word.

Learn more:brainly.com/question/21842366?referrer=searchResults

4 0
2 years ago
In which situations would a text-to-speech tool be useful? Check all that apply. A reader needs to hear a word pronounced. O A s
ExtremeBDS [4]

Answer:

I'm not sure but I believe it would be A

Explanation:

This answer can't really be accurate as the reason can change for anyone.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Select the correct answer. Rachel needs to make a presentation on ethics and etiquettes in college. She has about 30 minutes to
    13·1 answer
  • Which is missing in most areas that do not have Karst topography?
    10·2 answers
  • Which of the following statements is true?
    12·1 answer
  • 1 Explain the difference between using a computer program and programming a computer.
    12·1 answer
  • What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user prog
    11·1 answer
  • 1. The Law of Superposition – the age of an object may be determined by the depth at which it is found, the deeper the object is
    14·1 answer
  • Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999. The drive is currently serving a request at cylinder 2,150,
    6·1 answer
  • What ethical concerns might arise from applying new IT to law enforcement?
    5·1 answer
  • Accept total number of participants (B) in class. A group of
    12·1 answer
  • The Carolina International School is more Earth-friendly than typical schools because
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!