A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

test

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Problem Set 2 small = 6 medium = 9 large = 20 maxpieces = 55 maxa = maxpieces/small maxb = maxpieces/medium maxc = maxpieces/large for a in range(0,maxa+1): for b in range(0,maxb+1): for c in range(0,maxc+1): combo = 20*c + 9*b + 6*a if combo in [50,51,52,53,54,55]: print 'McNuggets=',combo, 'a=',a, 'b=',b, 'c=',c Does it make sense? I don't know if what I am supposed for this problem.

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    That prints out all possible combinations, and in an odd order (due to the print statement being in nested for loops). It works, but for the next problems, it might help to think about using a function to return the combo (or False if there is no combo).

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.