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

PS1: How'd I do? Here's my code, what do you guys think? x = 3 z = 3 w = 999 while w > 0: if x%z != 0: z = z + 2 else: if x == z: w = w - 1 # print x x = x + 2 z = 3 else: x = x + 2 z = 3 else: x = x - 2 print x # print 'edn'

OpenStudy (anonymous):

its alright

OpenStudy (anonymous):

it works for problem #1, but where the second part? heres how i solved PS 1: from math import * #problem 1 primes = () for n in range(2, 7920): for i in range(2, n): if n % i == 0: break else: primes = primes + (n, ) #Problem 2 add = 0 l = 0 for x in range(0,1000): z = primes [x] ## print z add += log(z) print add / primes [x] ## print add, primes [x], add/ primes [x] what do you think?

OpenStudy (anonymous):

See, I thought they wanted us to do a looping program. They asked us to generate possible solutions, test them, and use some end test which will stop the loop. Yours is great though. It looks a whole lot cleaner than mine. It appears that you have watched a few more video lectures than me. haha

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!