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
NARA [144]
3 years ago
6

Someone please help me

Computers and Technology
1 answer:
Afina-wow [57]3 years ago
8 0

Answer:

first answer is correct 8

second answer is 12

You might be interested in
Write a program that inputs a time from the console. The time should be in the format "HH:MM AM" or "HH:MM PM". Hours may be one
monitta

Answer:

  1. def processTime(timeStr):
  2.    timeData = timeStr.split(" ")
  3.    timeComp = timeData[0].split(":")
  4.    h = int(timeComp[0])
  5.    m = int(timeComp[1])
  6.    
  7.    output = ""
  8.    if(timeData[1] == "AM"):
  9.        if(h < 10):
  10.            output += "0" + str(h) + str(m) + " hours"
  11.        elif(h == 12):
  12.            output += "00" + str(m) + " hours"
  13.        else:
  14.            output += str(h) + str(m) + " hours"
  15.    else:
  16.        h = h + 12  
  17.        output += str(h) + str(m) + " hours"
  18.    return output  
  19. print(processTime("11:30 PM"))

Explanation:

The solution code is written in Python 3.

Firstly, create a function processTime that takes one input timeStr with format "HH:MM AM" or "HH:MM PM".

In the function, use split method and single space " " as separator to divide the input time string into "HH:MM" and "AM" list items (Line 2)

Use split again to divide first list item ("HH:MM") using the ":" as separator into two list items, "HH" and "MM" (Line 3). Set the HH and MM to variable h and m, respectively (Line 4-5)

Next create a output string variable (Line 7)

Create an if condition to check if the second item of timeData list is "AM". If so, check again if the h is smaller than 10, if so, produce the output string by preceding it with a zero and followed with h, m and " hours" (Line 9 - 11). If the h is 12, precede the output string with "00" and followed with h, m and " hours" (Line 12 - 13). Otherwise generate the output string by concatenating the h, m and string " hours" (Line 14 -15)

If the second item of timeData is "PM", add 12 to h and then generate the output string by concatenating the h, m and string " hours" (Line 17 -18)

Test the function (Line 22) and we shall get the sample output like 2330 hours

5 0
3 years ago
Microsoft's Xbox operating system provides Xbox programmers with a set of common standards to use to access controllers, the Kin
ASHA 777 [7]

not be made for Xbox platform.

Hope this helps.

3 0
4 years ago
10.13 lab 10c: output range with increment of 5 write a program whose input is two integers. output the first integer and subseq
Lynna [10]

he program gives an output in increment of 5, if the first inputted integer is less than the second. The program written in python 3 goes thus

3 0
2 years ago
To enter a blank line into a document, press the ____ key without typing any text on the line.
Brilliant_brown [7]
You click the "enter" key found on the right side of most keyboards
7 0
3 years ago
Sherri has recently been injured. She is having a problem using her left hand and would like to use a stylus to move her mouse a
Alona [7]

Answer:

d) Digitizer

Explanation:

In computing a digitizer refers to a piece of hardware that converts analogue input to digits. Analog signals refers to signals that are in a continuous range such as light, sound and records. A digitizer therefore basically gets signals from (touch, sound, light etc.) and transforms and transports it to the CPU. On a tablet or laptop, the signals will received from the finger of a stylus (digital pen).

6 0
3 years ago
Other questions:
  • Please help i really need to turn this in already
    6·1 answer
  • Which equation is correct regarding the measure of ∠MNP? m∠MNP = One-half(x – y) m∠MNP = One-half(x + y) m∠MNP = One-half(z + y)
    15·2 answers
  • Which is a benefit of peer-to-peer networking?
    10·1 answer
  • Which of the following is a typical concern for developers while using prototypes?
    6·2 answers
  • Explain why the 7 bit standard ASCII code needs to have the highest bit set to a zero
    11·1 answer
  • Which of the following is a Federal law that provides a definition of the term cyberterrorism and under which young people prima
    7·1 answer
  • An array of Strings, names, has been declared and initialized. Write the statements needed to determine whether any of the array
    9·1 answer
  • What is the output of the following program segment? int main() { int num = 5; cout &lt;&lt; num &lt;&lt;" "; change(num); cout
    8·1 answer
  • How to start the ms excel​
    10·1 answer
  • I need help ASP 3rd grade math ​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!