for example I have this 2 inputs:
JavaScript
x
2
1
2 5 2
2
and:
JavaScript
1
4
1
2
2
5
3
2
4
How do I take all of them using the same code?
Advertisement
Answer
Read lines of input and split them until you get 3 total values.
JavaScript
1
7
1
inputs = []
2
while len(inputs) < 3:
3
values = input().split()
4
inputs.extend(values)
5
6
print(inputs) # this will print [2, 5, 2]
7