Please explain how this snippet works and what is the outcome

Can you please explain whats the outcome"

lst = [1, 2, 3, 4, 5]
lst_2 = [ ]
add = 0

for number in lst:
    add += number
    lst_2.append(add)

print(lst_2)

Homework?

Have you made an attempt yourself? Where did you get stuck?

Never mind, I got it
0+ 1, (1+2), (1+2+3), (1+2+3+4), (1+2+3+4+5)

[ 1, 3, 6, 10, 15 ]

That is not what the script is doing.

For example, the 6 is not a product of 1+2+3, it’s a product of 3+3, because on the 3rd iteration, add = 3 which is then added to the 3rd element of lst

hmm, okay . thanks for the clarification