Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Omri Zachay
472 PointsFunction error
Hi,
Now, make a function named summarize that also takes a list. It should return the string "The sum of X is Y.", replacing "X" with the string version of the list and "Y" with the sum total of the list.
What is wrong with my code ?
def summarize(a_list):
total = 0
for item in a_list:
total = total + item
print (the sum of a_list is total)
thanks
1 Answer

Ken Alger
Treehouse TeacherOmri;
Welcome to Treehouse!
Your function isn't returning the string as the challenge directions state. You will probably want to use the .format()
method for this challenge in the return statement.
Post back if you are still stuck.
Happy coding,
Ken
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherEdited for markdown