Code Coach "MILITARY TIME"
inp = str(input()) pisah = [] pm = "PM" duabelas = '12' if pm in inp: if duabelas in inp: for x in inp.split(" "): pisah.append(x) print(pisah[0]) else: for x in inp.split(":"): pisah.append(x) a = ' '.join(pisah) b = a.split(" ") c = int(b[0]) + 12 pisah.append(str(c)) print(b[1] + ":" + b[2]) else: if duabelas in inp: for x in inp.split(":"): pisah.append(x) a = ' '.join(pisah) b = a.split(" ") c = int(b[0]) - 12 pisah.append(str(c)) print(b[1] + ":" + b[2]) else: for x in inp.split(" "): pisah.append(x) print(pisah[0]) From that code, why I got wrong at Test Case #3 and Test Case #5. Even that is manual method, but I think its right.