For line separated input, we have constraint on number of inputs we take from the user
n = int(input())
input_list = []
for i in range(n):
user_input = int(input())
input_list.append(user_input)
for i in input_list:
print(i)
For the above code, if my n = 5 and if I give even 6 inputs, they take only 5 inputs and print them line by line.
However, in the case of space separated input.
n = int(input())
input_list = [int(i) for i in input().split()]
for i in input_list:
print(i)
In the above code, we are not considering n value while taking input in space separated pattern.
Is there any other way, where we take only n values from user in space separated pattern.