Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Stuck on Python function Challenge Q 1

I'm stuck on what the right approach is for this question. I know this works to get the required answer, but isn't structured according to expectation.

How do I split the list into individual segments and add them together?

```example_list=[1,2,3]
aw = example_list[0]
bw = example_list[1]
cw = example_list[2]

ans=int(aw+bw+cw)
print(ans)

```

Hi Timothy,

Inside your function you need a variable that is going to store the sum and then each time through the for loop you're going to add a number from the list to your sum variable. Then you want to return that sum.

```def add_list(lst):
sum = 0
for num in lst:
sum = sum + num

return sum
```

Did you try using a for loop like the challenge recommends?

Yes I tried something like

```def add_list(example_list):
for item in int(example_list):
item + item

2. On line 3, you're adding the current item in the list to itself. So if item #1 is `2`, line 3 just calculates `4`.