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
Evan Hoyt
8,703 PointsPython 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
Treehouse Moderator 68,468 PointsTry 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,
Evan Hoyt
8,703 PointsThank you for that link. It really helped. Again thank you so much for your time.
Evan Hoyt
8,703 PointsEvan Hoyt
8,703 PointsI 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
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsYour 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?
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsFor further help, you can look at my answer to a similar question could-someone-point-me-in-the-right-direction.