# Can anyone help a python lerner here

Develop a Python method change(amount) that for any integer amount in the range from 24 to 1000 returns a list consisting of numbers 5 and 7 only, such that their sum is equal to amount. For example, change(28) may return [7, 7, 7, 7], while change(49) may return [7, 7, 7, 7, 7, 7, 7] or [5, 5, 5, 5, 5, 5, 5, 7, 7] or [7, 5, 5, 5, 5, 5, 5, 5, 7].

so im a new python lerner and i found this on internet but couldnt solve it if anyone can help i would be thankful

Suffice it to say, you’ve taken on a pretty bit task for a beginner. Seasoned learners will have some difficulty with this one; I know it will be tricky for me.

It is similar to the brick problem whereby we are given a quantity of bricks with length 1 and a quantity of bricks with length 5, and then asked whether there is any combination of them that will add up to a given goal. For instance,

``````small, big, goal = 3, 2, 8
``````

will work since 3 + 5 is 8. It will also work with goals of [1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13] but will not work with goals of 4 or 9.

This doesn’t require any special knowledge. A start would be to try to solve for low input values and see if you find any patterns or otherwise consider how you go about solving it and write down the steps (in code)

the main problem is that i took a corsera course and its for beginners and i paid for it and this quiz came in the final questions and i have no clue how to solve it i started it like this
def change(amount):
if amount == 24:
return [5, 5, 7, 7]
but dont know what to do next pls just write me the code to know my mistake the deadline for the course is already gone so i wont get profit from it haha
and i would be thankful

dude i started the coding python course since one week dah im not a super intelligent i have also no clue how to solve it
i started like this
def change(amount):
if amount == 24:
return [5, 5, 7, 7]
so pls write me the code just to help me know my mistake

As @ionatan pointed out, there is no special knowledge required for this but it is a tricky question, and the reason it was left til last in the quiz (to wait until your juices are flowing from the other exercises, some of which may hold vital clues to this one).

so what shall i write now hahah i need to write a code lol XD

Again, no special knowledge needed, including python.
It’s a trivial problem which will unravel quickly as soon as you start trying things.

So what if it takes you a few hours. Maybe that’s time well spent rewiring your brain to even start approaching problems (which is all this takes). Or leave it be.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.