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

Not sure with this one.

Hey guys, so i know that the code is not done fully. However i'm trying to make the code myself as much as possible such that i learn from it. Which is why i didn't look anywhere for any answers. Can anyone guide me, towards what i should do ? Without giving any answers.

APPRECIATED!!!!

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(list):
for items in add_list:
  return items + items
break

5 Answers

what happens after you erase break and run code? =)

Hey man thanks for responding. When i remove it, it starts saying Bummer! IndentationError: for items in add_list:

You need to use the += operator.

Thanks for the response David.

Like this? def add_list(list): for items in add_list: return items += items break

I was thinking more like...

def add_list(list): temp = 0 for items in add_list: temp += items return temp

2 questions. First of all, why the temp = 0? Like what is your idea of doing all of this.

def add_list(list):
  for items in add_list
  temp = 0 for items in add_list:
    temp += items 
      return temp

it still tells me Bummer! SyntaxError: for items in add_list

Hey Kenneth.

Alright,however it keeps telling me
Bummer! SyntaxError: for items in add_list

Is that due to the way i have structured it (with the tabs/spaces etc)?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Well, add_list is your function, not the argument passed to the function, so you want for item in list: (really, use a better name than list since list() is a builtin function). You also need to make sure everything is indented inside your function. What you have in the first post isn't indented.

Did it pass? =)