This program is made, so it graphs a spiral with N steps. What else could I add to this program?
Can this code be improved?
import matplotlib.pyplot as plt
N = 100
arr = [(0, 0)]
x = []
y = []
for u in range(1, N):
for i in range(1, 5):
if i % 4 == 1: # first corner
arr.append((u, - u + 1))
elif i % 4 == 2: # second corner (same positive numbers)
arr.append((u, u))
elif i % 4 == 3: # third corner (same [one positive and one negative] numbers)
arr.append((-u, u))
elif i % 4 == 0: # fourth corner (same negative numbers)
arr.append((-u, -u))
print(arr) # just to easily check all coordinates
for i in arr:
x.append(i[0])
y.append(i[1])
plt.plot(x, y)
plt.show()