Im trying to write a code in python, that needs to take in user input into 3 lists at the same time. This is my code currently:
N = int(input(""))
x = [] ## x, y, and r are different lists
y = []
r = []
for i in range(N):
x,y,r = input("").split()
x = int(x)
y = int(y)
r = int(r)
print(x)
print(y)
print(r)
My sample input: (You can ignore the <-- x,y,r and the <-- N. I just put that for refrence.)
3 <-- N
1 4 5 <-- x,y,r
2 8 1 < -- x,y,r
6 7 2 < -- x,y,r
Expected Output:
[1, 2, 6]
[4, 8, 7]
[5, 1, 2]
Unfortunately, this is what my output looks like:
6
7
2
NOTE: *I can't find any errors in my code above so any help would be much appreciated! For anyone wondering why the format of taking inputs is very specific, the problem I am trying to solve requires a very strict format which is what I am using. I need to take the "N" input first which will tell me how many times I need to get the input for x,y,r. And yes, I do need to take the values x,y,r at the same time.
Nbut that can only be three. What should happen if the user enters 4?