想问一下我哪里错了。怎么改?

img

img

import random
import matplotlib.pyplot as plt
x=0
y=0
distance=[]
for i in range(100000):
    mydir = random.randint(1,4)
    if mydir == 1:
        x+=1
        distance.append((x**2+y**2)**0.5)
    elif mydir == 2:
         y+=1
         distance.append((x**2+y**2)**0.5)
    elif mydir == 3:
         x-=1
         distance.append((x**2+y**2)**0.5)
    else:
         y-=1
         distance.append((x**2+y**2)**0.5)
plt.plot(range(100000),distance)
plt.show()
# plt.close()

倒数第6行,yi,应该是y1