Making a recursive function to sort the graph points. When compiling get the error:
TypeError: can only concatenate list (not "NoneType") to list
Sample xy values: [[1, 1], [2, 2], [2, 3], etc.]
def FindNext(list_xy):
if len(list_xy) == 1:
xo = list_xy[0][0]
yo = list_xy[0][1]
return [xo, yo]
xo = list_xy[0][0]
yo = list_xy[0][1]
for i in range(len(list_xy)):
xf = list_xy[i][0]
yf = list_xy[i][1]
dx = xo - xf
dy = yo - yf
d = (dx**2+dy**2)**0.5
if d == 2**0.5 or d ==1:
return [xo, yo] + FindNext(list_xy[1:])
FindNext(xy)
FindNextreturn a value.xyworks for me when I run your code. Which line is the error supposedly on?