list comprehension does not return empty list
<p>I tried to find the relevant question but couldn't find so creating a new one. 
My program creates a new list using list comprehension in python as per a simple if condition. </p>

<pre><code>  Newone = [ temp for temp in Oldone if temp % 2 != 0 ]
</code></pre>

<p>It works fine but when in some situation it doesn't work. For example this one </p>

<pre><code> Oldone = [1]
 Newone = [ temp for temp in Oldone if temp % 2 != 0 ]
</code></pre>

<p>This returns [1] but i am expecting Newone to be [] </p>

<p>If you are not sure what's happening. Your list comprehension:</p>

<pre><code> Newone = [ temp for temp in Oldone if temp % 2 != 0 ]
</code></pre>

<p>Means; put in my new list <code>Newone</code> all <code>temp</code> values from my existing list <code>Oldone</code>, which satisfy the condition <code>temp % 2 != 0</code> (Essentially keep only odd numbers, since the remainder is 1, whenever an odd number is divided by 2)</p>

python list condition list-comprehension