I'm trying to make a loop that finds distances of values of one list, to the values of another list.
The data itself is of varying dimensions in a coordinates layout. Here is an example
x = ['1.23568 1.589887', '1.989 1.689']
y = ['2.5689 1.5789', '2.898 2.656']
I would like to be able to make a separate list for each y value and its distance from each x value. There are always more x values than y values.
This is what I have so far:
def distances_y(x,y):
for i in y:
ix = [i.split(' ',)[0] for i in y]
for z in x:
zx = [z.split('',1)[0] for z in x]
distances_1 = [zx - ix for z in x]
return distances_1
print(i +"_"+"list") = [distance_1]
But I'm stuck on how to create individual lists for each y value. Each distance also needs to be a list in itself, a list in a list so to speak.
The largest problem is that I am unable to use packages besides tkinter for this.