I want to make a self-avoiding 2D random walk in python. I have an idea how to do it, but my programming skills aren't very good and the code doesn't work. My idea is to create two lists: one where I store x and y (i.e. the coordinates I've already been to) and one with the points that are around the point I'm currently at (I marked it as neighbors). I want to create a new variable surviving_neighbors. This is where the surrounding points where I have not been (e.g. I am currently at (1,1); I have already been at (0,1) and (1,2) so that my surviving neighbors would be (1,0 ) and (2,1)). Imagine it like the dot is on the square grid and it can only go up, down, left or right but it cannot land twice on the same point. I want to get Surviving_neighbors using the difference method: I put neighbors.difference(list of coordinates) and save in a variable what is in the list of neighbors, but not in the list of coordinates I was on. The first problem I have is that I don't have one list with coordinates, but x and y are stored separately. Next, I would use choice(surviving_neighbors) and thus choose new coordinates. This creates another problem: I probably won't be able to call it a trajectory, but I'll have to define it again in terms of x and y...
The teacher suggested that I store x and y as vectors, but I don't know how to do that. Please help!

Code:
-------------------------------------------------------------------------------------------------------------------
from random import choice
import numpy as np
from matplotlib import pyplot as plt
plt.style.use(['science', 'notebook', 'dark background'])

x, y = 0, 0

coordinates = [(x, y)]
for time in range(10):
dx, dy = choice([(0,1), (-1,0), (0,1), (0,-1)]);
x, y = x + dx, y + dy;
X.append(x);
Y.append(y);

# neighbors = [ x+1,y;
# x-1;y;
# x,y+1;
# x,y-1 ];

# surviving_neighbors = neighbors.difference(X,Y)
# trajectory = choice(surviving_neighbors)

plt.plot()