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.

Start your free trial

Python

Python Functions Code Challenge Task 2

I cannot complete task two. Whenever I add something it tells me task one is no longer passing. Here is my existing code for code one.

def add_list(list):
    sum = 0
    for items in list:
        sum = sum + items
    return(sum)

add_list([1, 2, 3])

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,468 Points

Try removing the call to add_list: add_list([1, 2, 3]). The challenge will validate your code with its own call to add_list.

Also the parens in your return statement are not needed,

I am still having the same problem. I am confused as to what the question is asking for and do not remember him adressing this in the movie. Your suggestions did help though.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

Your code passes when I run it in the functions challenge part 1.

When it says "Task 1 is no longer working" it can sometime means there is a syntax error in your code for part 2 that makes the recheck of part 1 fail outright. Can you post the code that causes part 2 to give you this error?

Thank you for that link. It really helped. Again thank you so much for your time.