Hi guys,
I'm new to the forum and to progamming. I've started following a set of online video lectures as an introduction to programming using python. One of the problem they asked to solve is to create a simple program that computes and prints the 1000th prime number.
I got the following so far:
count = 1 #counts the prime number. With already there, the number "2"
num = 2
prime = [2] #creates a list with "2" already in there
while (count <1000):
if num%2 !=0:
count = count+1 #increase by one every time there is a prime number
prime.append(num) #add the prime number to the list
num = num + 1
print prime [:10] #prints the 10th prime number
But instead of showing the the 1000th (or 10th) prime number, it seems to be only displaying odd numbers (and 2).
I'm guessing I've done something wrong here:
if num%2 !=0:
We have only been introduced to basics such as loops, variables and boolean operators so I want to keep it simple.
I would appreciate any help. With thanks in advance,