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 trialPau Diaz Gallifa
1,616 PointsI can't figure out where is the syntax error, please help.
I run this script in my own computer and it works well...I can't find any syntax error. Thanks
def add_list(number_list):
sum = 0
for item in number_list:
sum = sum + item
return sum
def summarize(number_list):
sum = 0
for item in number_list:
sum = sum + item
return "The sum of {} is {}".format(number_list,sum)
number_list = [1,2,3]
sum = add_list(number_list)
result = summarize(number_list)
print sum
print result
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsAre you running Python 2 on your home computer? Because the print statements are not correct for Python 3.
Remove the 5 debug statements at the bottom of your code, I get: Congrats! You completed the challenge!
Pau Diaz Gallifa
1,616 PointsPau Diaz Gallifa
1,616 PointsYes, I am running Python2. I removed these 5 lines at the bottom and now it works well.
Thanks a lot!