PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Military time problem this code is not wright
time = input()
t1 = time.split(":")
if time.find("P") > 0:
time = time.replace(t1[0], str(int(t1[0]) + 12))
else:
if int(t1[0]) < 10:
print (t1[0])
time = time.replace(t1[0],"0"+t1[0])
time = time.split(" ")
print(time[0])
# can any one tell me what should be the diffrence in output?
sentence = input()
list = sentence.split(':')
if 'PM' in sentence:
sentence = str(int(list[0])+12)+':'+list[1]
if 'AM' in sentence and int(list[0])<=9:
sentence = '0'+list[0]+':'+list[1]
list = sentence.split(' ')
print(list[0])
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run