A community for students.
Here's the question you clicked on:
 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.
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

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0attached is the code.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Take 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.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Thanks 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?

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.043 is correct. 49 is possible with 2 20's and a 9.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0well i have improved the codes efficiency a little bit... pls look at it and give criticism.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0the second attached code.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0This part: if((n6)==a): return True else: return False is equivalent to: return (n6)==a

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0okk.. i got it. Thanks.
Ask your own question
Sign UpFind more explanations on OpenStudy
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
 Engagement 19 Mad Hatter
 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.