I got a user input like the example from the photo and made a list with it. 

```
n = int(input())

while n != 0:
    row = input()
    a = row.strip().replace(':',' ').split(' ')
    n -= 1

```

How can I get the time given into 24-hour format? I tried using if statement like this

```
if a[2] == "2" and a[4] == "pm":
    a[2]= "14"

```

but when pm is not specified I get stucked. All hours are ordered by time like in the example.

[enter image description here](https://i.stack.imgur.com/JAqq3.png)