Question



POD 3: Tick Tock Instructions There are 24 hours in a day, but we all think about them differently. Some people and places in
• hour an integer value, from 0 to 23, representing the hour in the day in 24 hour time • minutes an string value from 0 to 5
Sample input/output: Input Output 24-hour time: 0:00 12-hour time: 12:00 24-hour time: 8:17 12-hour time: 8:17 24-hour time:
I Full Screen pod3.py New print(24-hour time: , hour, :, minutes, sep), 13 14 # PLEASE START YOUR WORK HERE # 15 23 # PL
0 0
Add a comment Improve this question Transcribed image text
Answer #1

'''
Python version : 3.6
Python program to convert 24-hour time to 12-hour time
'''
# define the hour and minutes values
hour = 0
minutes = "00"

# print the 24-hour time
print("24-hour time : ",hour,":",minutes,sep="")
# convert the hour from 24 hour to 12 hour
# if hour == 0, then hour = 12
if hour == 0:
   hour = 12
elif hour > 12: # hour > 12 then subtract 12 from hour
   hour = hour - 12
  
# print the 12-hour time
print("12-hour time : ",hour,":",minutes,sep="")

#end of program

Code Screenshot:

Output:

Add a comment
Know the answer?
Add Answer to:
POD 3: Tick Tock Instructions There are 24 hours in a day, but we all think...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PoD 4: Greetings all around! Instructions Good day! Bonjour! Good evening! Bonsoir! You are in a...

    PoD 4: Greetings all around! Instructions Good day! Bonjour! Good evening! Bonsoir! You are in a bilingual country! A nice thing to know is how to greet people in any language. You are going to write a program to make sure that we know how to greet the peoples around us. The French word "Bonjour" means "Good day. This is greeting can be used from morning until dusk (let's 18:00 or 6pml. After dusk we might say "Bonsoir" or "Good...

  • Modify the hours stage of figure 10-18 to keep military time (00-23 hours) SECTION 10-4/DIGITAL CLOCK...

    Modify the hours stage of figure 10-18 to keep military time (00-23 hours) SECTION 10-4/DIGITAL CLOCK PROJECT 763 AMPM tens hrs PM CLRN 74160 units hrs O] QB QC ENT QD ENP RCO units hrs 2] units-hrs[3] CLRN Tens of hours PRN Units of hours CLRN FIGURE 10-18 Detailed circuitry for the HOURS section to count tens of hours. The BCD counter is a 74160, which has two active- HIGH inputs, ENT and ENP, that are ANDed together internally to...

  • Need help creating a basic java string program using nested if/else, return loops or while loops...

    Need help creating a basic java string program using nested if/else, return loops or while loops or charAt methods while returning information using a console, Please leave notes as to compare my program and see where I went wrong or could've used a different method. secondsAfterMidnight Input: String that represents time of day Returns: integer number of seconds after midnight (return -1 if String is not valid time of day) General time of day format HH:MM:SS(AM/PM) These are examples where...

  • MATLAB code help! Function Name: chemTimer Inputs: 1. (double) The current position of the hour hand 2. (double) The current position of the minute hand 3. (double) A positive or negative number of m...

    MATLAB code help! Function Name: chemTimer Inputs: 1. (double) The current position of the hour hand 2. (double) The current position of the minute hand 3. (double) A positive or negative number of minutes Outputs: 1. (double) The position of the hour hand after the specified time 2. (double) The position of the minute hand after the specified time Background: Oh no, you were running late to your Chem lab and completely forgot your reaction timer! It's a good thing...

  • As you can see this was a solution to a problem if someone could go through...

    As you can see this was a solution to a problem if someone could go through line by line and explain to me especially the timeof day file that would help me alot.I am having trouble understanding the logic used with the first class of code time of day. A mutable encapsulation of the time during a day. public class TimeofDay private static final int SECONDS PER MINUTE = 60 private static final int MINUTES PER HOUR = 60 private...

  • Determine the time period of the day in C++ a. Request an hour in military time...

    Determine the time period of the day in C++ a. Request an hour in military time between 0 and 23 inclusive. b. If the value for hour is invalid: 1. Output Invalid hour". 2. Repeat the input request. a. Request the minutes b. Print the time using hh:mm format C. Convert to 12 hour format (i.e. AM/PM) and print Use a single if/else-if/else structure to do the following: 1. If the hour is between 0 and 12 inclusive, output "It...

  • 3 Write a sinusoidal function in standard form that represents the temperaturo in Bellingham during the...

    3 Write a sinusoidal function in standard form that represents the temperaturo in Bellingham during the summer months. The maximum temperature of 84 degrees occurs at 4:30PM each day The minimum temperature of 41 degrees occurs at 4:30 AM each day Base your function, f(t) on time t, wheret 0 is considered to be noon, (not midnight). That is, 10:00 AM would be t -2. a) f(t) = b) Graph the function you found in part a) for one 24-hour...

  • Write a program that reads a string from the keyboard and tests whether it contains a...

    Write a program that reads a string from the keyboard and tests whether it contains a valid time. Display the time as described below if it is valid, otherwise display a message as described below. The input date should have the format hh:mm:ss (where hh = hour, mm = minutes and ss = seconds in a 24 hour clock, for example 23:47:55). Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from...

  • Time.cpp: #include "Time.h" #include <iostream> using namespace std; Time::Time(string time) {    hours = 0;   ...

    Time.cpp: #include "Time.h" #include <iostream> using namespace std; Time::Time(string time) {    hours = 0;    minutes = 0;    isAfternoon = false;    //check to make sure there are 5 characters    if (//condition to check if length of string is wrong)    {        cout << "You must enter a valid military time in the format 00:00" << endl;    }    else    {        //check to make sure the colon is in the correct...

  • 9. A concert hall is filling with people from noon until show time at 3:00 pm....

    9. A concert hall is filling with people from noon until show time at 3:00 pm. The table below shows the rate of people entering the concert hall (measured in people per minute) at particular times. Time Noon 1:00 1:30 2:00 2:20 2:40 2:55 2:50 3:00 8 11 14 17 21 23 26 25 Rate (people per min) a)Estimate the total number of people attending the show using a midpoint approximation for four partitions: [noon, 1:30]. [1:30,2:20], [2:20,2:50], and [2:50,3:00]...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT