+ 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))
5 Respostas
+ 5
For inputs like 1:15 AM it should show
01:15 but your code is showing 1:15 just
+ 3
That's 1:15 PM ,I am talking about 1:15 AM
+ 2
Here my code will show 13:15 for 1:15
+ 2
Oo i m sorry i got the mistake.
+ 2
Yeah thankyou for point out my mistake now i fixed it 😊