Military time challenge in python
Hello, my code fails 2 of the hidden test cases and I'm not sure why, could anyone point me in the right direction? stri = input() stri = stri.split() num = stri[0] word = stri[1] # splits input into numerals and daypart, then assigns those to their own variables num = num.split(":") #splits hours and minutes at num[0] and num[1] repectively if word == "PM" and int(num[0]) != 12: output = int(num[0]) + 12 #adds 12 to hours if pm except for special case of 12pm, as thats still 12:00 in military time elif word == "AM" and int(num[0]) == 12: ouput = int(num[0]) - 12 #checks for special case of 12am, not sure what the expected output is, but if 00:00, then -12, if 24:00 then +12 else: output = int(num[0]) output = str(output) if len(output) == 1: ouput = "0" + output #converts to string and adds leading 0 if necessary print(f"{output}:{num[1]}")