0

Military time code-coach ?

I made the following code for military time problem in code coach, x = input().split(' ') t = x[0].split(':') if x[1]=='PM' and int(t[0])!=12: a = int(t[0])+12 elif x[1]=='AM' and int(t[0])==12: a = '00' else: a = t[0] time = [str(a)] + [':'] + [t[1]] print(''.join(time)) Can anyone tell me, for which input the code will fail?

1/16/2020 2:44:43 PM

Akash Sil

2 Answers

New Answer

0

Akash Sil The input time is in AM is raising error Input :- 3:45 AM returns 03:45 but your code return 3:45 fix that with same format XX:XX

0

DishaAhuja thanks