list comprehension error and algorithm : <p>There is a couple questions about the list comprehension in python. The first is I do not know why there is error in the code below:</p>

<pre><code>alist = [1,2,3,4,5,6,0,9,9,4,5,0,0,2,3,0,9,6]
test = [x++ for x in alist if x != 0]
File "&lt;stdin&gt;", line 1
test = [x++ for x in list1 if x != 0]
               ^
SyntaxError: invalid syntax
</code></pre>

<p>Another question is I want to write a list comprehension to count non-zero element. Use <code>alist</code> as an example, I want to return a list called <code>count</code> containing 1 or 0: 1 if the element in <code>alist</code> is not zero and zero is the element in <code>alist</code> is zero. So the result should be:</p>

<pre><code>alist = [1,2,3,4,5,6,0,9,9,4,5,0,0,2,3,0,9,6] 
count = [1,1,1,1,1,1,0,1,1,1,1,0,0,1,1,0,1,1]
</code></pre>

<p>Thank you very much. </p>
