Question: I'm trying to create a function that multiplies each item in a list and returns the total. The function doesn't stop running until memory runs out.
Can someone please explain to me why this isn't working? 

```
items = [1,2,3,4,10]

def mult2(items):
    if not items:
        return 0
    return mult2(items[0]) * mult2(items[1:])

mult2(items)

```

Answer: 
There are two issues:

1. Single element is passed to `mult2`, but sequence is expected. That's why `TypeError: 'int' object has no attribute '__getitem__'` is raised, due to trying to subscripting int (code being executed resolves to `1[1:]` which is simply not possible).
2. Your exit condition is broken. Neutral multiplier is 1, not 0.

After fixes your code would look like this:

```
def mult2(seq):
    if not seq:
        return 1
    return seq[0] * mult2(seq[1:])

items = [1,2,3,4,10]
assert 240 == mult2(items)

```
Fixed the errors in the OP, and this works:

```
items = [1,2,3,4,10]

def mult2(items):
    if len(items) == 1:
        return items[0]
    return items[0] * mult2(items[1:])

print "sum:",mult2(items)

```