0

Military Time - why it 4 not passing?

input = str(input()) if len(input) > 5: if 'A' in input and len(input) == 7: print ('0' + input[0:4]) elif 'A' in input and len(input) == 8: print (input[0:6]) else: h = int(input.split(':')[0])+12 m = input [2:6] print (str(h) + m) else: print (input)

9th Apr 2020, 7:13 PM
Kim 🐘
Kim 🐘 - avatar
3 Respuestas
+ 1
For 12:00 AM, output should be 00:00 For 12:00 PM output should be 12:00 These two conditions don't get correct results...
9th Apr 2020, 7:22 PM
Jayakrishna 🇮🇳
+ 1
Not for only exactly 12:00 What I said is if 12:MM AM, output shloud be 00(hour). =>00:MM, and for 12 hour PM, output should be 12 hour only 12:MM.. Hour changes, with Same minutes.. So there may be input, not only 12:00 AM/PM, but also may be 12:22 AM => 00:22 12:07 AM. => 00:07 12:45 PM => 12:45 12: 55 PM => 12:55
10th Apr 2020, 9:28 PM
Jayakrishna 🇮🇳
0
input = str(input()) if len(input) > 5: if 'A' in input and len(input) == 7: print ('0' + input[0:4]) elif 'A' in input and len(input) == 8: print (input[0:6]) elif input == '12:00 AM': print ('00:00') else: h = int(input.split(':')[0])+12 m = input [2:6] print (str(h) + m) else: print (input) Still not working
10th Apr 2020, 7:51 PM
Kim 🐘
Kim 🐘 - avatar