- 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.
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.
+ 1
Taste stuck at the part where you do all the work 👍
0
which part you currently stuck at ?
0
im not sure hoe to begin
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.