'problems with """input().split() in loop""" in python

n, m, k, r = tuple([int(i) for i in input().split()])

roads = []

for road in range(m):
    t = tuple(list(map(int, input().split())))
    roads.append(t)

print(roads)

My input is this:

6 6 2 6
0 1
1 2
2 3
3 4
4 1
3 5

I expected that output would be: [(0, 1), (1, 2), (2, 3), (3, 4), (4, 1), (3, 5)]

but output is this: [(), (0, 1), (), (1, 2), (), (2, 3)]

Why?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source