+ 5

Help me in finding my mistake in

12 hr to 24 hr time conversion: #can anyone tell me that on which time the program can be fail time,period = input().split(' ') hr,min= time.split(':') if period.upper() == 'AM' and int(hr) ==12: hr24 = "00" elif period.upper() == 'PM' and int(hr) ==12: hr24 = "12" elif period.upper() == 'PM': hr24 = int(hr)+12 else: hr24 = hr print("{}:{}".format(hr24,min))

2nd Jun 2020, 6:34 AM
Anjali Singh
Anjali Singh - avatar
5 Respostas
+ 5
For inputs like 1:15 AM it should show 01:15 but your code is showing 1:15 just
2nd Jun 2020, 6:40 AM
Abhay
Abhay - avatar
+ 3
That's 1:15 PM ,I am talking about 1:15 AM
2nd Jun 2020, 6:44 AM
Abhay
Abhay - avatar
+ 2
Here my code will show 13:15 for 1:15
2nd Jun 2020, 6:43 AM
Anjali Singh
Anjali Singh - avatar
+ 2
Oo i m sorry i got the mistake.
2nd Jun 2020, 6:44 AM
Anjali Singh
Anjali Singh - avatar
+ 2
Yeah thankyou for point out my mistake now i fixed it 😊
2nd Jun 2020, 6:50 AM
Anjali Singh
Anjali Singh - avatar