+ 8

Errors in code Military Time from Code Coach

Test 3 and Test 5 throw an error. Help me find errors in the code https://code.sololearn.com/c3J4Q45qAtAr/?ref=app

2nd Sep 2020, 9:54 PM
Konstantin K
Konstantin K - avatar
5 Antworten
+ 4
Isn't military time suppose to always be 4 numbers? 0100, 0200, 0300, etc?
2nd Sep 2020, 10:17 PM
Steven M
Steven M - avatar
+ 8
Steven M Thanks, I fixed the bugs. Problem solved
2nd Sep 2020, 10:31 PM
Konstantin K
Konstantin K - avatar
+ 7
Namit Jain Thanks
3rd Sep 2020, 5:31 AM
Konstantin K
Konstantin K - avatar
+ 4
I ran some quick tests, on your code, this is what I found. Also, your code fails if I give it "am" or "pm" in lower case... I dont know if that is what is making it fail 1 AM = 1:00 2 AM = 2:00 3 AM = 3:00 4 AM = 4:00 5 AM = 5:00 6 AM = 6:00 7 AM = 7:00 8 AM = 8:00 9 AM = 9:00 10 AM = 10:00 11 AM = 11:00 12 AM = 0:00 1 PM = 13:00 2 PM = 14:00 3 PM = 15:00 4 PM = 16:00 5 PM = 17:00 6 PM = 18:00 7 PM = 19:00 8 PM = 20:00 9 PM = 21:00 10 PM = 22:00 11 PM = 23:00 12 PM = 12:00
2nd Sep 2020, 10:04 PM
Steven M
Steven M - avatar
+ 3
Time.zfill(5)
3rd Sep 2020, 4:02 AM
Namit Jain
Namit Jain - avatar