I am new to programming in Python. I had used Matlab extensively. I want to check if in a 2D array,any two arrays are same. I have points lets say (x,y,z) coordinates in the format
data=[[x1,y1,z1],[x2,y2,z2]...[xn,yn,zn]].
I want to check if any point is equal to another point. And if there are any similar instance, i want to know how many are same and which two are same. The code i have in Python is something like
data = [[1,2,3],[3,1,8],[4,2,5],[1,2,3]]
s=0
for i in range(len(data)):
a=data[i]
for j in range(len(data)):
while i != j:
if data[j]==a:
s=s+1
c=i
d=j
print(s)
print(c,d)
and i also dont want the answer that point N is equal to point N etc I also have used
for j in range(i,len(R)):
but it also dont give the correct answer.
Aucun commentaire:
Enregistrer un commentaire