+ 1
[Solved] Military Time
2/5 test cases failed, and unable to figure out why. Any suggestions? https://code.sololearn.com/cGafztGYCBQ2/?ref=app
7 Antworten
+ 1
You should check the zfill function!
But be careful: There's and extra character in time[:-2] which is the space between the time and AM.
+ 2
When I write 3:15 AM
I should get 03:15, but I'm getting 3:15.
+ 1
Thanks LDSD, that extra space didn't mattered but zfill worked for me. [Updated the code]
+ 1
And HonFu thank you too, I got to know lately what you meant, until then I was debugging the wrong part of 'if', my bad.
0
Thanks Mirielle👽, I was just trying naive approach without any modules. But yeah I will start to use this module.
0
Yeah Mirielle👽, I agree with you, but when I started solving this challenge I was like I gotta apply my knowledge of slicing. Now that I solved with the help of you guys, I will try using the relevant module. Not just this, but all.
0
Thanks a lot LDSD, I googled it and that worked for me 👌