anonymous
  • anonymous
Pset2part3 I've got a working piece of code for it but I looked up the solution for it and other people say its 43. Why is my code giving me 50? http://dpaste.com/hold/525967/
MIT 6.00 Intro Computer Science (OCW)
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
hey kNicola are the two study groups different you responded to the last post on retro.openstudy, is this a different study group?
anonymous
  • anonymous
add print numSmall, numMedium, numLarge to your code. There is an obvious error when it comes to calculating numSmall.
anonymous
  • anonymous
It stems from your calculation of numLeft.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
I don't get what's wrong with it that is why on the next line i divide by 6? and where do you want me to add the print function?
anonymous
  • anonymous
Add the print function right after numSmall=numSmall/6
anonymous
  • anonymous
I added the print but its a huge loop and is giving me a lot of numbers which i don't want to sit and test by hand.
anonymous
  • anonymous
That's fine, but you should have noticed that numSmall routinely went into the negatives, while numMedium and numLarge functioned correctly.
anonymous
  • anonymous
Yes I did but in line i have a checker to take out negative solutions.
anonymous
  • anonymous
line 9
anonymous
  • anonymous
Oh, I know what the problem is. Sorry for all of this. Your counter is set too high. It's supposed to be 5 not 6. def mcdonalds(): count=0 numNuggets=1 while count<5: x=solution(numNuggets) if x==1: count=count+1 else: count=0 numNuggets=numNuggets+1 print numNuggets mcdonalds()
anonymous
  • anonymous
Thanks I actually noticed this when I was debugging but I did it the other way and made my counter start at 1. But I forgot to change the resets to 1. Thank you so much I have been stuck on this problem for a few days.
anonymous
  • anonymous
Should i post my final solution so other people can see what I did?
anonymous
  • anonymous
Hah, no problem. I felt really dumb there for a little while. You had your checking system set up differently from mine so I thought it was a problem with it. The negatives definitely threw me off. Sure, post it up.
anonymous
  • anonymous
Yeah everyone has there own style of coding. So its not your fault it's more so my fault for not putting in comments to help out.
anonymous
  • anonymous
For anyone who is working on this problem and needs a reference here is my completed code. http://dpaste.com/hold/525984/

Looking for something else?

Not the answer you are looking for? Search for more explanations.