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

add_list question in python

def add_list(numList)
  totalSum = 0
  for num in some_list 
    totalSum = totalSum + num
  return totalSum

^ here is my code for the function, but it says I have a syntax error at "def add_list(numList)" ... anyone understand why this might be the case?

I forgot the colon I think! I could've sworn there was no colon in the video example they showed us.....

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Function definitions are always followed by a colon (:). Yours isn't :)

Same for your for loop.