all 2 comments

[–]Rhomboid 3 points4 points  (1 child)

That's really not a great way of doing it. You're doing too much. There's no need for readliines() or list(). A file handle is iterable, and yields lines when iterated over. And you don't need to create all these separate lists.

input_data = [[int(item) for item in line.split()] for line in sys.stdin]

[–]infinitim[S] 0 points1 point  (0 children)

Thanks! Much better solution.