It works for 3 of 5 test but I can't see the 2 it doesn't work for and I can't find the issue. Problem military time. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

It works for 3 of 5 test but I can't see the 2 it doesn't work for and I can't find the issue. Problem military time.

https://code.sololearn.com/ci4NrOO5G59Z/?ref=app

18th Mar 2022, 4:52 AM
Nick Accordino
Nick Accordino - avatar
2 Answers
+ 1
# Hi! You can compare your solution with mine: print((lambda f: f"{f[0] + (-12 if f[0] == 12 and f[2] == 'AM' else 12 if f[0] != 12 and f[2] == 'PM' else 0):02}:{f[1]:02}")([int(i) if i.isdigit() else i for i in input().upper().replace(":", " ").split()])) # My solution handle for example both lowercase an uppercase: am/AM etc. # My solution handle the input: 01:34 AM. Your gives wrong answare: (001:34). # Past in my code before (above) yours and input for example: # 01:34 AM # 01:34 AM # and compare the results. Test with different cases to you find what is not same with the two solutions, and work out a solution.
18th Mar 2022, 5:52 AM
Per Bratthammar
Per Bratthammar - avatar
0
Cuz whover made that decided that problem 12:20 AM = 24:20 instead of 00:20
18th Mar 2022, 5:46 AM
Raul Ramirez
Raul Ramirez - avatar