I am really new to programming and have started with Python following the MIT - I am testing myself as I am considering return to education later in year and convert into Software sector (Development, Testing).
Anyway the assignment I am on is to compute the 1000th prime number. Bear in mind I only have studied up to and including: Print, If, For, While, Tuples.
Here is the code I created for this exercise. I am at the moment checking up to 10 primes until I understand where it is I am going wrong.
count = 1 #count of prime numbers primes =()#tuple of primes testnum = 3 #number to be tested for prime while (count<10): for i in range(2,testnum): if testnum%i ==0: testnum+=1 else: primes = primes + (testnum,) testnum+=1 count+=1 print primes
The result I get is (3, 5, 7, 9, 11, 13, 14, 15, 17). This is obviously incorrect.
I don't think my For loop is correct.
Can anyone point me in the right direction.
Is this normal when starting off to be frustrated and demoralized that I can't get it to work or will I improve?