Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 17 Online
OpenStudy (anonymous):

I have been thinking about the primes problem in problem set 1 for a day now and this is all I have. check=3 iteration=20 while iteration>0: print("Checking:",check) for x in range(2,check): if check%x==0: print(x,"Not prime, moving on") if check%x>0: print(x,"Possible prime") iteration-=1 check+=1 Kinda interesting but definitely not where I need to be to solve the problem. And suggestions on where to go next?

OpenStudy (anonymous):

I guess i should have comments in there so people can actually understand whats going on... but i dont.

OpenStudy (anonymous):

OK where to start, i think your jumping ahead with your functions, problem set 1 should not use the for statement, as it needs to be paired with the return statement now your going to need three conditions (that I can think of) if something is prime (divisible only by 1 and itself) if something is obviously not prime (divisible by something other then one and itself) it its inconclusive (your test comes up with a remainder) keeping in mind you can create two parts for each test if x == y and y>z report back when you have something a little bit more on track or if you got lost with my explanation

OpenStudy (anonymous):

I suppose I should catch up on the readings before I do this problem set. I didn't even know that the for command wasn't introduced. I was probably relying on examples I had looked at for help. After a couple minutes work, this is what I have:

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!