Concept explainers
Python please:
Write a program that takes a 12-hour formatted input with AM or PM and updates it to the 24-hour formatted time:
-
If the time is between 12:00:00 AM and 12:59:59 AM, the time should be 00:00:00 and 00:59:59.
-
If the time is between 01:00:00 AM and 11:59:59 AM, the time should be as is but without AM.
-
If the time is between 12:00:00 PM and 12:59:59 PM, the time should be as is but without PM.
-
If the time is between 01:00:00 PM and 11:59:59 PM, the time should have 12 added to it.
Note: Here, the minutes and seconds stay as is; only the hour part changes.
For example, if the input is
12:05:33 AM
the output is
00:05:33 is the 24-hour formatted time of 12:05:33 AM
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 5 images
- Write a Python code This lab requires you to write a complete program using a condition controlled loop, a counter controlled loop, and an accumulator. The program is as follows: Write a program that will allow a grocery store to keep track of the total number of bottles collected for seven days. The program will calculate the total number of bottles returned for the week and the amount paid out (the total returned times .10 cents). The output of the program should include the total number of bottles returned and the total paid out. The program will ask the user if they have more data to enter and will end the program if they do not. Step 1: In the pseudocode below, declare the following variables under the documentation for Step 1. A variable called totalBottles that is initialized to 0 This variable will store the accumulated bottle values A variable called counter and that is initialized to 1 This variable will control the loop A variable called todayBottles…arrow_forwardComputer Science The script below demonstrates a very basic loop structure. Indicate the value of R1 after 5 iterations of the loop. (Given the very first line of code, you can assume R1 starts out as 0x00)arrow_forwardThis program in C++ obtains a series of letter grades as input from a user. The program should calculate and output the total grade points and the grade point average (note: you may have to track the total number of inputs and the grade points to calculate the grade point average). The algorithm should execute 3 times for testing purposes.Use the appropriate loop for the main structure of the program that will stop accepting letter grades when the user inputs X. Also, choose the appropriate selection statement to convert the letter grade to the correct grade points.Additional Requirements:• Use appropriate data types and variable names throughout the code.• Use constants appropriately. Output needs to look like the image below.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education