Hi guys, i have completed the firstproblem in ps 1..got the output ..i want someone to take a look and give any suggestions ..i think my coding was too naive compared to other programs here.... thanks in advance...

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.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

Hi guys, i have completed the firstproblem in ps 1..got the output ..i want someone to take a look and give any suggestions ..i think my coding was too naive compared to other programs here.... thanks in advance...

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

primecount=0 testnumber=3 divisor=2 while(testnumber%2!=0): while(divisor
I think it looks pretty good. The only thing is it looks as though it will test for a divisor up to one less than the testnumber. Ex. testnumber is 999, divisor will test to 998, which you do not need to do. You can stop the divisor much earlier. This would only make a difference the higher your testnumber becomes.
That will work, though I dislike the use of the else clause on loops as I find them very difficult to read. I much prefer the use of boolean variables as controls. primecount=1 # we're starting at 3, so we add 1 to our count for 2 (the first prime) testnumber=3 while primecount < 1000: # find the 1000th prime divisor=2 divisorFound = False while (divisor

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

blah.. this interface is terrible at formatting code. that divisor = divisor + 1 line should be unindented to the same level as the if not in the if's block.
thankyou..the interface of this website was too bad.....your program was neat
i think you are also using all the divisors less than the number ..its not needed and it takes more time ....using squareroot saves more compilation time...

Not the answer you are looking for?

Search for more explanations.

Ask your own question