Question: Given a time in 1 2 - hour AM / PM format, convert it to military ( 2 4 - hour ) time. Note: -

Given a time in 12-hour AM/PM format, convert it to military (24-hour) time.
Note: -12:00:00AM on a 12-hour clock is 00:00:00 on a 24-hour clock.
12:00:00PM on a 12-hour clock is 12:00:00 on a 24-hour clock.
Example
s=?'12:01:00PM'
Return '12:01:00'.
s=?'12:01:00AM'
Return '00:01:00'.
Function Description
Complete the timeConversion function in the editor below. It should return a new string representing
the input time in 24 hour format.
timeConversion has the following parameter(s):
string s: a time in 12 hour format
Returns
string: the time in 24 hour format
Input Format
A single string s that represents a time in 12-hour clock format (i.e.: hh:mm:ssAM or hh:mm:ssPM
Using the diagram above, if the student wants to get to page 3, they open the book to page 1, flip 1
page and they are on the correct page. If they open the book to the last page, page 5, they turn 1 page
and are at the correct page. Return 1.
Function Description
Complete the pageCount function in the editor below.
pageCount has the following parameter(s):
int n: the number of pages in the book
int p : the page number to turn to
Returns
int: the minimum number of pages to turn
Input Format
The first line contains an integer n, the number of pages in the book.
The second line contains an integer, p, the page to turn to.
Constraints
1n105
1pn
Solve the problem in Python Programming Langauge and explain each line of code so that it can be understood
 Given a time in 12-hour AM/PM format, convert it to military

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!