Reverse error: [closed]

0

in eat.txt there is the following content:

02:26:31 14:44:45 09:53:27
14:17:35 12:33:44 09:30:12

I'm reversing the order of the elements in the following way:

import sys

with open 'eat.txt as f:
    lines = f.read().strip().splitlines()

for line in lines:
    out = ' '.join(sorted(line.split(), reverse=True))
    print(out)

Output:

14:44:45 09:53:27 02:26:31
14:17:35 12:33:44 09:30:12

Why does it only change the first line and the second does not?

    
asked by anonymous 02.12.2016 / 14:43

1 answer

1

If you notice, the second line is already reversed. So it looks like nothing happened.

    
02.12.2016 / 15:28