+ 2

Military time code coach challenge

I have finally solved this challenge and it took me an hour. https://www.sololearn.com/coach/70?ref=app And I have finally come up with this code that successfully convert time in 12 hour format with AM and PM to 24 hour format. #"time12" is input value in 12h format like this 11:00 AM time12 = input().split() #After splitting AM/PM, now splitting 11:00 as 11 and 00 and new list is named "time" time = time12[0].split(":") if time12[1] == "AM" and int(time[0])>=10: print (time12[0]) elif time12[1] == "AM" and int(time[0])>=1: print (f"0{time12[0]}") elif time12[1] == "AM" and int(time[0])==0: print (f"00{time12[0]}") else: t = int(time[0])+12 print(f"{t}:{time[1]}") I spent a lot of time trying to solve this medium level challenge. That has created self-doubt in my mind. Is it okay to take so longer to write such small piece of code or I am slower for beginners?? Also if you could suggest something that could help me improve my skill and pace.. I express my gratitude in advance.

28th Dec 2020, 11:57 AM
CHANDAN ROY
CHANDAN ROY - avatar
3 Answers
+ 16
CHANDAN ROY Here you have already solved the code coach... And asking for "suggestions" which declares the QUESTION open-ended. .. I believe you should reframe your question... If it's open-ended then better to use feed for that ! Otherwise I can have one guess that you are saying that "how to make the code short"?
28th Dec 2020, 12:03 PM
Piyush
Piyush - avatar
+ 15
CHANDAN ROY Feed is to be called "activity feed" When you will click on the middle tab and gonna scroll.. all the posts which will be appearing are done through " activity feed" q/a is sensitive somehow... All kinds of suggestions you can post on "activity feed"( I think am cleared with the explaination of activity feed :) ) Have a look here too - https://www.sololearn.com/Discuss/1316935/?ref=app
28th Dec 2020, 12:20 PM
Piyush
Piyush - avatar
+ 1
Piyush I have edited this post describing the purpose of it. Sorry for asking such silly questions but what is "feed" and "open-ended"
28th Dec 2020, 12:10 PM
CHANDAN ROY
CHANDAN ROY - avatar