请问这个错误如何解决,谢谢
from random import choice
class Randomwalk:
def __init__(self, number_point=5000):
self.number_point = number_point
self.x_value = [0]
self.y_value = [0]
def fill_walk(self):
while len(self.x_value) < self.number_point:
x_direction = [1, -1]
x_distance = choice([1, 2, 3, 4, 0])
x_step = x_direction * x_distance
y_direction = choice([1, -1])
y_distance = choice([0, 1, 2, 3, 4])
y_step = y_distance * y_direction
if x_step == 0 and y_step == 0:
continue
x = self.x_value[-1] + x_step
y = self.y_value[-1] + y_step
self.y_value.append(y)
self.x_value.append(x)