+ 1
Code Coach "Military Time"
I can't pass hidden test #3 and #5. What's wrong? input = input().split(' ') pm = {1:'13', 2:'14', 3:'15', 4:'16', 5:'17', 6:'18', 7:'19', 8:'20', 9:'21', 10:'22', 11:'23', 12:'00'} if input[1] == 'AM': input = input[0].split(':') if len(input[0]) < 2: input[0] = list(input[0]) input[0].insert(0, '0') input[0] = str(input[0]) elif input[1] == 'PM': input = input[0].split(':') input[0] = pm[int(input[0])] print(':'.join(input))
6 Antworten
+ 1
12:00 AM must be translated to 00:00
12:00 PM to 12:00
do not use variable names that match operator names, parse data to new variables
+ 1
Googled about 12h time format and understood. Thanks.
+ 1
I fixed that, but still #3 and #5 failed
0
Your code fails with input like this "2:17 AM", result must be 02:17
0
Thanks, solved