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

Here are my codes, I expect questions and corrections ps1a and ps1b http://dpaste.com/577717/ ps2 and ps2a http://dpaste.com/577720/

OpenStudy (anonymous):

does it work??

OpenStudy (anonymous):

Hi jhonny, I didn't get a prime list from your code for ps1a. I would recommend setting an initialization point, e.g. assign top=3 as initial value and build from there.

OpenStudy (jhonny111s):

the codes are tested and work, maybe you no indented tested: prime(3) i dont undestand you

OpenStudy (anonymous):

prime does seem to print primes up to top. sum_log doesn't work - http://dpaste.com/579732/ diophantine doesn't work - http://dpaste.com/579740/ diophantine1 works - it prints 43 which i think is correct

OpenStudy (jhonny111s):

in sum_log this is_prime(num): in the code i explained that def is_prime(num): cont=0 j=num while j!=0: if num%j==0: cont=cont+1 j=j-1 if cont==2: return 1 else: return 0

OpenStudy (jhonny111s):

and diophantine(12) you need 2 box of six, the answer is correct 6 9 20 2 0 0

OpenStudy (anonymous):

it printed 'no se puede' - i took that to mean that it could not be bought.

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!