Military time code coach | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Military time code coach

cheems = str(input()) cheems.split() if cheems[1] in dict: print(cheems) dict = { "PM":PM "AM":AM } def AM: print(cheems[0]) def PM: if cheems I stoped writing the code because i Saw it wouldnt work, whats the Best method to solve this

24th Mar 2020, 3:31 AM
poligono2007
poligono2007 - avatar
3 Answers
0
what was your initial method to solve?
24th Mar 2020, 4:19 AM
Choe
Choe - avatar
0
@Choe first i wouldve split the input into two then define the functions AM and PM, then i wouldve made a dictionary wich would call the functions AM or PM when it would process the second word of the input (AM or PM), then those functions would manipulate the first word of the input wich is the hours and minutes
24th Mar 2020, 11:47 AM
poligono2007
poligono2007 - avatar
24th Mar 2020, 2:58 PM
Choe
Choe - avatar