'''
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:






POD 3: Tick Tock Instructions There are 24 hours in a day, but we all think...
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 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 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 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...
in C++ 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 or you may choose to use separate variables for the hours,...
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 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 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...
C++ PROGRAM Write a program that converts from 24-hour notation to 12-hour notation. For example, it should convert 14:25 to 2:25 PM. The input is given as two integers. There should be at least three functions, one for input, one to do the conversion, and two for output (one for 12-hour time and another for 24-hour time). Record the AM/PM information as a value of type char, ‘A’ for AM and ‘P’ for PM. Thus, the function for doing the...
This lab will create a digital clock based on nested FOR loops for hours, minutes, and seconds, and a WHILE loop for doing over and over so that your clock works for all year long without interruption. Note: If a group of students is interested, we could create a real digital wall-mounted clock to be placed in our classroom, so I can keep track of the time during my lectures. The actual clock would be based on the LED Strip...