Someone please find the bug in my code for problem sat 2a. I am always getting 78 as a result not 49.
attached is the code.
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.
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?
43 is correct. 49 is possible with 2 20's and a 9.
Thanks dude
well i have improved the codes efficiency a little bit... pls look at it and give criticism.
the second attached code.
This part: if((n-6)==a): return True else: return False is equivalent to: return (n-6)==a
okk.. i got it. Thanks.
Join our real-time social learning platform and learn together with your friends!