Ask your own question, for FREE!
Computer Science
OpenStudy (anonymous):

Ok, sean, thanks for that. I realized the mistake just after i posted the question. so here is my modified code, which just runs and runs and runs, in loops, goes up to the highest prime under 10000, then goes back to two. i just wanna make it stop at the 1000th prime. how do i do that? http://codepad.org/SANjfhZ9 @MIT 6.00 Intro Co…

7 years ago
OpenStudy (anonymous):

is there some function, say 'print x number of times' or something?

7 years ago
OpenStudy (anonymous):

Try thinking about the program as having two variables that will increase : a primeCounter and a candidate to be tested. Then your while loop is simply while primeCounter < 1000: do the following. Within the while loop you need to test if your candidate is prime. If it is, candidate and primeCounter increase, if it isn't increse your candidate and try again. Does that help? I would get rid of line 5 of your code and try to figure out another way to approach it.

7 years ago
OpenStudy (anonymous):

while x is less than 1000 do sompthing If condition met x = x + 1 When x hits 1000 it'll stop

7 years ago
OpenStudy (anonymous):

In your program what are count and n? Inside your while loop add a print statement that prints what count is (and a message that says it's count). Inside the first for loop add a print statement that prints n and count (and some text so you clearly know which is which). Is that the output you expected?

7 years ago
Can't find your answer? Make a FREE account and ask your own question, OR you can help others and earn volunteer hours!
Latest Questions
Skullmaster2017: \ai test
31 minutes ago 0 Replies 0 Medals
mtowns39: Mi hermano ___________________ a mi amiga Elisa.
6 hours ago 0 Replies 0 Medals
Moon: MCAT Tutorial: Hydrostatics
12 hours ago 6 Replies 0 Medals
MRichardson84: If angle FBA=7x+6y, what is angle FBA
17 hours ago 2 Replies 0 Medals
bmelson02: Which is the area of a circle with a radius of 5 units
21 hours ago 1 Reply 0 Medals