How to remove duplicate values from the list in python with out using any predefined variable
<p>I am trying to remove duplicate values from a list.</p>

<p>This is what i have so far:</p>

<pre><code>list1=[1,2,3,4,3,2,1]
list2=[]
l=len(list1)

for i in range(l):
    if list1[i] not in list2:
         list2.append(list1[i])

print(list2)
# [1, 2, 3, 4]
</code></pre>

<p>And it works just fine.</p>

<p>However, i am wondering if you can get the same result under the following conditions:</p>

<p><strong>Conditions:</strong></p>

<ul>
<li>Should not use any predefined functions to remove item</li>
<li>Can use loops but, only once</li>
<li>And should not use any other 2nd list</li>
</ul>

<p>I tried but I didn't make any progress. Is it possible..?</p>