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 trialNancy Melucci
Courses Plus Student 36,143 PointsWhy does this not only fail but kill task one?
OK...this is where I bailed last time. I passed this Code Challenge part 1, then added the code for Summarize, and not only got it wrong but got told that it ruined the code I submitted for first part of the Challenge.
I have to tell you that's pretty discouraging, but anyway. Please can someone help give me a hint so I can go back, adjust part one and not add a part 2 that goes off like a bomb and destroys everything?
# add_list([1, 2, 3]) should return 6
# summarize([1, 2, 3]) should return "The sum of [1, 2, 3] is 6."
my_list = [1,2,3]
def add_list(my_list):
total = 0
for num in my_list:
total = total + num
return total
x = add_list(my_list)
print (x)
def summarize(my_list):
total = 0
for num in my_list:
total = total + num
return total
print "The sum of 1, 2, 3, is ", total
summarize(my_list)```
1 Answer
John Sanchez
3,325 PointsIs this the same question that you had in the more recent thread or is it different?