- 3

Function definition

Write a function named convert_12_to_24 that will accept an integer hour, an integer minute, and a string that is either AM or PM to indicate whether the time is before or after noon. It should return a string indicating a 24 hour time with the hour and minute separated by a colon.

16th Oct 2019, 6:28 PM
Mamadou Barry
5 ответов
+ 3
time="hh-mm-am/pm" //taking input(it will come in above format) hh=int(time [0:2]) mm=int(time[3:5]) am_pm=time[6:8] Now you have all information to solve this problem, use am_pm part to form different cases and solving it.
16th Oct 2019, 8:12 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
Taste stuck at the part where you do all the work 👍
16th Oct 2019, 7:08 PM
will
will - avatar
0
which part you currently stuck at ?
16th Oct 2019, 6:39 PM
Taste
Taste - avatar
0
im not sure hoe to begin
16th Oct 2019, 6:43 PM
Mamadou Barry
0
start by creating the function take 3 input to 3 different varables for hour, minute, and ampm. then think.. you you normally convert it into 24hour format. write them down in full detail.
16th Oct 2019, 6:47 PM
Taste
Taste - avatar