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

Without giving a full answer, can anyone give me an expected result of pset2 problem 3

OpenStudy (anonymous):

you want the number but not the code?

OpenStudy (anonymous):

lol@bwCA

OpenStudy (anonymous):

Ok, scratch that i know i screwed up somewhere. Any Advice: #11:53 3/9/12 #McNugget Diophantine #MIT - OCW CIS 6.00 PSET2a bestsofar = 0 def mng (mcnuggets): ##mng = mcnuggetgrinder Pkg3 = 20 Pkg2 = 9 Pkg1 = 6 for numPkg3 in range (0, mcnuggets + 1, Pkg3): for numPkg2 in range (0, (mcnuggets + 1) - (numPkg3 * Pkg3), Pkg2): numPkg1x = mcnuggets - (numPkg3 * Pkg3) - (numPkg2 * Pkg2) if numPkg1x % 6 == 0: return True for n in range (1, 150): ## n = nuggets if mng(n) != True: if n > bestsofar: bestsofar = n print "Largest number of McNuggets that cannot be bought in exact quantity:", bestsofar

OpenStudy (anonymous):

pls use a code pasting site: dpaste.com, pastebin.com, codepad.org, are a few - they all have syntax highlighting and the last will execute your script. your function needs to return False also, if appropriate if you have an expression that evaluates to a boolean, don't compare it to True or False in an if statement - just use it as is - http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#testing-for-truth-values http://pastebin.com/PMD4kmtf

OpenStudy (anonymous):

I answered your question on the given link! The number is 149... http://codepad.org/2ploRkxf

OpenStudy (anonymous):

149 is not the answer

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!