0

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.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

0

By default, inline-blocks have vertical-align: baseline, which is why it jumps around if another height changes. To fix this, add this style to the div element with p tag.

 vertical-align: top;
Sasi Kumar M
  • 2,440
  • 1
  • 23
  • 23