n=input() y=n.split() a=([int(x) for x in y]) print(a)
output
python .\\input_into_list.py 1 2 3 [1, 2, 3]
The above
in the first script, you are adding all the values to a in a single line.
in the second script, you are reassigning a on each loop.
try to append to a instead.
n=input() y=n.split() a = [] for x in y: a.append(int(x)) print(a)