Hi all, Im new to programming and just finished assignment 1.1 (which I think is correct). Could someone tell me if there's room for improvement or what could be done better. thanks
heres the code: http://codepad.org/45TEO6yE
(it only runs the first 20 primes to save time)
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
I think it's very nice, but, maybe you could change n%x == 0 to n % x == 0 which improves readability.
It's part of the python style guide: http://www.python.org/dev/peps/pep-0008/
it works great, it will find primes less than 10000. If your search criteria was different or changing you would have to guess what the limit would be in line 2, or know the answer b4 hand. could you rewrite it to find just the 2000th prime? without having to guess how big that number is?