Check array to find if they are the same

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


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.

Professor Asked on October 26, 2020 in Android langue,   Python.
Add Comment
2 Answer(s)

    This working well:

    data =[[1,2,3],[4,5,6],[2,5,6],[0,9,1],[1,5,7],[2,5,4]] st=[] dic={} while len(data)>1:     d = data[0]     data.remove(d)     st=[]     for dat in data:         k=0         for i in d:             if i in dat:                 k=k+1         if k>1:             st.append(dat)     if len(st)>0:         dic[str(d)]=st for key in dic.keys():     print(key," : ", dic[key]) 
    Professor Answered on October 26, 2020.
    Add Comment

      Apparently, found a workthrough myself

      d=[[1,2,3],[3,5,4],[5,6,9],[0,2,1],[1,2,3]] s=0 for i in range(len(d)):    for j in range(i+1,len(d)):        if d[i]==d[j]:            s=s+1            x=i            y=j print(s) print(x,y) 
      Professor Answered on October 26, 2020.
      Add Comment

      Your Answer

      By posting your answer, you agree to the privacy policy and terms of service.