0
I’m taking my first steps python
and I want to store a series of values I got in calculating the distance between points in a matrix NxN to then select the values of each line and establish a limit value condition, and set the values of that limit my code was like this:
import numpy as np
n = int(input('numero de elementos = '))
print('-=' *30)
v =np.zeros(n)
X = np.zeros(n)
Y = np.zeros(n)
for i in range(n):
X[i] = float(input('x ='))
Y[i] = float(input('y ='))
print(X,Y)
print('-=' *30)
for i in range(0,n):
for j in range(0,n):
dist = (((X[i]-X[j])**2)+((Y[i]-Y[j])**2))**(0.5)
print(f'[{dist}]', end='')
print()
R=2
for dist in range(0,n):
if dist<=R:
mat_distancia = dist
print(mat_distancia)