Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

Hello! I just completed problem 3 on problem set 2. Can you guys look at my code to see if any areas to improvement? or your code to compare? n=1;Diophantine=();check=0 while (n<70): a=0;b=0;c=0;ans=() while (6*a+9*b+20*c

OpenStudy (anonymous):

please use a code pasting site: - http://dpaste.com - http://pastebin.com - http://www.repl.it/ - http://pastie.org - http://codepad.org - http://ideone.com paste your code there and post the link here. select Python syntax highlighting when u paste.

OpenStudy (anonymous):

Thank you bwCA! here is the link: http://dpaste.com/826170/

OpenStudy (anonymous):

i limited my for loop ranges to say n / 6 + 1 or 20 / 6 + 1. and added break statements after each for statement to break if the equation evaluated to > n

OpenStudy (anonymous):

again, it's cool... might as well allow user to enter constants, and print entire solution you can see how much the break statements speed it up: try commenting them out http://dpaste.com/826177/ of course, if you allow negative constants -5a + 6b -c = 17 the breaks will miss alot.

OpenStudy (anonymous):

Thank you !!! Guys! I really appreciate your help!

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!