i want to make a code that takes in the x and y coordinates as inputs and a 2d list as an output to match the x and y coordinates.
This is my code:
def d2_coordinate(size,x,y):
d2_plane = []
d2_row = []
for i in range(size * 2 + 1):
d2_row.append(0)
for i in range(size * 2 + 1):
d2_plane.append(d2_row)
d2_plane[size - y][size + x] = 1
return d2_plane
size = int(input(""))
x_coordinate = int(input(""))
y_coordinate = int(input(""))
print(d2_coordinate(size,x_coordinate,y_coordinate))
so lets say i put in numbers like size = 2, x = 0, y = 0, i expect the outcome of
[0,0,0,0,0]
[0,0,0,0,0]
[0,0,1,0,0]
[0,0,0,0,0]
[0,0,0,0,0]
instead, i get
[0,0,1,0,0]
[0,0,1,0,0]
[0,0,1,0,0]
[0,0,1,0,0]
[0,0,1,0,0]
i dont understand what i did wrong here. Please help me out!