title: How to find duplicate elements in array using for loop in Python?
body: <p>I have a list with duplicate elements:</p>
  
  <pre><code> list_a=[1,2,3,5,6,7,5,2]
  
   tmp=[]
  
   for i in list_a:
       if tmp.__contains__(i):
           print i
       else:
           tmp.append(i)
  </code></pre>
  
  <p>I have used the above code to find the duplicate elements in the <code>list_a</code>. I don't want to remove the elements from list.</p>
  
  <p>But I want to use for loop here.
  Normally C/C++ we use like this I guess:</p>
  
  <pre><code> for (int i=0;i&lt;=list_a.length;i++)
       for (int j=i+1;j&lt;=list_a.length;j++)
           if (list_a[i]==list_a[j])
               print list_a[i]
  </code></pre>
  
  <p>how do we use like this in Python?</p>
  
  <pre><code>for i in list_a:
      for j in list_a[1:]:
      ....
  </code></pre>
  
  <p>I tried the above code. But it gets solution wrong. I don't know how to increase the value for <code>j</code>.</p>