Cd mS 1B alll 28% 0 5:45 pm
om VU Lav a aa
PROBLEM CODE RESULT
Military Time
You want to convert the time from a 12 hour
clock to a 24 hour clock. If you are given the time
ona 12 hour clock, you should output the time as
it would appear on a 24 hour clock.
Task:
Determine if the time you are given is AM or PM,
then convert that value to the way that it would
appear on a 24 hour clock.
Input Format:
A string that includes the time, then a space and
the indicator for AM or PM.
Output Format:
A string that includes the time in a 24 hour
format (XX:XX)
Sample Input:
1:15 PM
Sample Output:
neary SI 4B ull 28% 8 5:46 pm
ar 0 e
Somme T pa aa <
PROBLEM CODE [pte 0]
1 | inpt=input()
2 |num="" Pata
3 |A=0
4 |P=0
5 |M=0
6
7 |for i in inpt:
8 aaa
fo) int(i)
0) num=num+str(i)
i haes] ee
iv.
13 if i == "A" or i=="a":
cs al
15 if i =="m" or i=="M":
ae] 1 el ua
Va if i =="p" or i=="P"
oy P=P+1
19
20 |num=int(num)
21 |*''if num<=100:
22 aT eal hele)
23 |elif num>=1259:
ys num=1259"''
25
26 |if A==1 and M==1:
ras if num>=1200 and num<=1259:
rr num=str(num) @
29 num1=num[2: ]
et) num="00"+num1
cH
Ey elif num>=1000 and num<=1159:
33 num=str(num)c+}
Somme T pa aa as
mB alle
28% 8 5:46 pm
PROBLEM CODE RESULT
ee lee meno ele) aa
ieee mae be L0
num=100
elif num>=1259:
Ta] al 0)
if A==1 and M==1:
if num>=1200 and num<=1259:
num=str (num)
num1=num[2: ]
num="00"+num1
elif num>=1000 and num<=1159:
num=str (num)
Cut
num="0"+str (num)
print (num[0:2]+":"+num[2:])
elif P==1 and M==1:
num=int (num)
num=num+ 1200
if num>=2400 and num<=2459:
num=str (num)
num1=num[2: ]
num="12"+num1
num=str (num)
print (num[0:2]+":"+num[2:])