I'm completely new to programming...

```
L = [1, 2, 3, 4, 5]
n = 1
S = sum(L[0:n])

while n < 5:
    n += 1

print(n)  # output: 5
print(S)  # output: 1

```

Why does python not change the parameter `n` in the `sum` function while it does change `n` itself? Can someone explain the logic behind that and show me a way to change `n` in the `sum` function so that `S` becomes 15 instead of 1?