title: recursive solution for coin change problem
body: <p>i need to write an algorithm that receives a number and a list of numbers and returns the number of possible combinations of numbers from the list that can create the sum number. for example: def coin(5,[1,2,5,6] should return the number 4 because there are 4 possible combinations from the list that can create together the number 5. below there is the code that i tried but it does not work. the output is 6 instead of 4 and i would love some help in understanding why.</p>
  <pre><code>def coin(n,lst):
      if n&lt;=1:
          return 1
      else:
          total=0
          for i in range(len(lst)):
              change=lst[i]
              if change&gt;n:
                  continue
              else:
                  result=coin(n-change,lst[i:])
                  if result&gt;0:
                      total+=result
          return total
  print(coin(5,[1,2,5,6]))
  </code></pre>