I've started the MIT open course for beginners (its in Python) and the first assignment is: Write a program that computes and prints the 1000th prime number.
I have started to do it on my own with the things learned in the lectures, but after a few attempts at nested loops, I can't seem to produce any working code. Can I have any tips, have my errors pointed out?
divisor = 1
result = 2
odds = 1
total = 1
# all odd int generation
for x in range(100):
total = total + 1
# test for each generated number
for n in range(1, total / 2):
if (result % divisor != 0):
print "result: ", result, " is prime!"
odds = odds + 2
result = odds
It is incomplete, but even this part doesn't work for me.