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 Basics (Retired) Putting the "Fun" Back in "Function" Functions

Will Beasley
Will Beasley
6,020 Points

I am getting the error: Bummer! summarize returned the wrong output. Got 'The sum of [1,2,3] is 6.' instead of 'The sum

I see some other people were having this issue. Let me know how to fix it. Thanks!

functions.py
# add_list([1, 2, 3]) should return 6
# summarize([1, 2, 3]) should return "The sum of [1, 2, 3] is 6."
# Note: both functions will only take *one* argument each.

def add_list(comb_list):
  total = 0
  for item in comb_list:
    total += item
  return total

def summarize(summary_list):
  str_ver = str.join(" ", str(summary_list))
  value = str(add_list(summary_list))
  the_return = "The sum of {} is {}.".format(str_ver, value)
  return the_return
Will Beasley
Will Beasley
6,020 Points

Nevermind, I was unclear on what this was asking, I removed str_ver and changed the return statement to:

the_return = "The sum of {} is {}.".format(str(summary_list), value)

and it works like a charm!

1 Answer

hector villasano
hector villasano
12,937 Points

Thanks ! But> the_return = "The sum of {} is {}.".format(str(summary_list), value)