Please help, this loop isn't working as expected and I don't know how to use booleans in Python
<p>Am trying to write a piece of python code that calculate and print 1000 prime number from 2
however i only got 1999 as the last element in my result. I know there a lot of questions like this asked before but I wanna know why is my code is not working.
btw: how do i declare a boolean value in python? cant find a clue even googled···sad</p>

<pre><code>mylist=[2]
num=1
count=0
while count&lt;1000:
    if num&gt;1:
        add=1
        for i in mylist:
            if num%i==0:
                add=0
                break
        if add==1:
            mylist=mylist+[num]
    num=num+2
    count=count+1
print mylist
</code></pre>
