Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
bear_19
Group Title
divisor=3
cand=3
count=2
while(count<1000):
if cand%divisor==0:
if cand==divisor:
cand=cand+2
divisor=3
count=count+1
print 'inside_if_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor)
else:
cand=cand+2
divisor=3
print 'inside_else_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor)
else:
divisor=divisor+1
print 'outside_else_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor)
prin
 one year ago
 one year ago
bear_19 Group Title
divisor=3 cand=3 count=2 while(count<1000): if cand%divisor==0: if cand==divisor: cand=cand+2 divisor=3 count=count+1 print 'inside_if_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor) else: cand=cand+2 divisor=3 print 'inside_else_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor) else: divisor=divisor+1 print 'outside_else_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor) prin
 one year ago
 one year ago

This Question is Closed

bear_19 Group TitleBest ResponseYou've already chosen the best response.0
I feel like i'm close to getting PS1, but once my counter hits 999, it hits the first inside_if_statement again and thus adds 2 to the 1000th prime. I'm not sure of a way around this... Would someone mind taking a look?
 one year ago

MicroBot Group TitleBest ResponseYou've already chosen the best response.0
what is the last print statement? i think there is some of your code missing.
 one year ago

bear_19 Group TitleBest ResponseYou've already chosen the best response.0
my final print statement basically says "print cand"
 one year ago

bear_19 Group TitleBest ResponseYou've already chosen the best response.0
figured it outhere's the working version: divisor=3 cand=3 count=2 while(count<1001): if cand%divisor==0: if cand==divisor: cand=cand+2 divisor=3 count=count+1 ##print 'inside_if_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor) if count==1001: cand=cand2 else: cand=cand1+1 else: cand=cand+2 divisor=3 ##print 'inside_else_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor) else: divisor=divisor+1 ##print 'outside_else_statement counter '+str(count)+'cand '+str(cand)+'divisor '+str(divisor) print cand
 one year ago

MicroBot Group TitleBest ResponseYou've already chosen the best response.0
im glad i could help :P xD now seriously : gj for figuring it out!:)and im sry i couldnt help cause i had no time:P maybe next time !
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.