A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

Someone please find the bug in my code for problem sat 2a. I am always getting 78 as a result not 49.

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

    attached is the code.

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

    Take a look at your ranges in isSolution. range(1,21) gives you [1,2,3,..,20]. Is there a number of nugget packages that you're missing? On another note, your script is mixing tabs and spaces. That can lead to indentation errors if you mix them in the same block. There are editors that allow you to "view whitespace". The preferred indentation block for Python is four spaces.

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

    Thanks GabeF for reading my code and telling me the errors. I have made the range(1,21) to range(0,21) but now it is giving me ans 43. is the ans 43 ryt?

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

    43 is correct. 49 is possible with 2 20's and a 9.

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

    Thanks dude

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

    well i have improved the codes efficiency a little bit... pls look at it and give criticism.

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

    the second attached code.

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

    This part: if((n-6)==a): return True else: return False is equivalent to: return (n-6)==a

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

    okk.. i got it. Thanks.

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