A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

So I did write a thing that successfully accomplishes what we were asked to do in question 2, but then I noticed the template provided has a for n in range thing... I have no idea how to incorporate that. I did it with a loop that would repeat every time the number of consecutive possible answers was less than the size of the smallest box...and I can't really see any other way of looking at it. Help?

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

    http://tinypaste.com/538a3

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

    Here is the beginning of the Python Tutorial in the online documentation - section 4.2 and 4.3 talk about for and range file:///C:/Users/Bill/Documents/Python%20Docs/python-2.7.1-docs-html/tutorial/index.html I tried your code and didn't get an answer. most solutions for this i have seen for this problem involve three nested loops, one each for a, b, and c - trying various combinations of boxes to see if n nuggets can be bought.

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

    whoops sorry, that link is http://docs.python.org/tutorial/

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

    I just tried it on every three numbers I could think of it and it gave me a correct answer for each of them. Trying to redo my test with a for loop I guess.

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

    if it works no need to change it, I tried it with 6, 9 and 12 but you are correct it works with 6, 9, and 20. nested (for) loops do come up often as solutions but I don't think you are required to use them if you can find another way.

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

    Hi I am kinda stuck on this one as well. I wrote my code but I am getting wrong results. It is giving me 73 as the largest unbuyable size instead of 43. I tried to debug a bit but vouldnt find my way out. Pasting tinypaste link here as well. Thanks for all the help in advance. http://tinypaste.com/6ceb2

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

    @Rmood I would not change counting variables "manually" in a for loop.(i, j, k) Let the for loop handle incrementing those variables and either set a flag or break from the loop when you have reached a goal.

  8. 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.