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 trialreza sajadian
718 PointsI dont know how to add the items to the "summarize" variable
I want to add the list items in the for loop, but i dont know how to do it!
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsThey want you to create another function called "summarize" - it is not a variable it's a function. This function should return a string using string formatting, and it will use the other function you made as well.
Let me know if you want more hints.
reza sajadian
718 Pointsreza sajadian
718 PointsI did as you said (if I have got you right!) but it still doesn't return the right answer. can you take a look please?
total = 0 also tried with "total = int() " list = [1, 2, 3] def summarize(item): return(total+item)
def add_list(list): for item in list: summarize(item) return(total)
add_list(list)
It says it returns 0! , but the answer should be 6.