How remove duplicates of tuples in a list, where the tuple elements are in reverse order?
<p>I am working on a assignment where my program shall ask the  user about a positive integer <em>n</em> which the prgogram will found the positive integers a and b, satsifying <em>a</em>^3 + <em>b</em>^3 = <em>n</em>.</p>

<p>My work and progress thus far is shown below</p>

<pre><code>def ramunajan(n):
    list=[]
    u = int(n**(1/3)+1)
    for a in range (0,u):
        b = (n-a**3)**(1/3)
        b = round(b)
        if a**3+b**3 == n:
            list.append((a,b))
    return list     

while True:
    try:
        n = input("FÃ¶r vilket positivt heltal n vill du hitta a och b dÃ¤r a^3 + b^3 = n ?\n")
    except ValueError or n &lt;= 0:
            continue
    else:
            break

list_1 = ramunajan(int(n))
print (list_1)
</code></pre>

<p>(The input text message is in swedish.)</p>

<p>My problem now is that when a user types in, eg 1729, the program gives output accordingly</p>

<blockquote>
  <blockquote>
    <blockquote>
      <p>For what postivie integer n would you like to find a and b, satisfying a^3 + b^3 = n ?</p>
      
      <p>1729</p>
      
      <p>[(1, 12), (9, 10), (10, 9), (12, 1)]</p>
    </blockquote>
  </blockquote>
</blockquote>

<p>How do I get rid of the reverse duplicates, ie (10, 9) and (12, 1), from the list?</p>

<p>Thanks!</p>

<p>replace <code>u = int(n**(1/3)+1)</code> with <code>u = int((n**(1/3))/2) + 1</code></p>

<p>so it checks only the first half of the pool, since the second half are duplicates</p>

python duplicates tuples