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 Introducing Lists Using Lists Multidimensional Lists

I'm getting an invalid syntax

travel_expenses = [
    [5.00, 2.75, 22.00, 0.00, 0.00],
    [24.75, 5.50, 15.00, 22.00, 8.00],
    [2.75, 5.50, 0.00, 29.00, 5.00],
]

print("Travel Expenses:")
week_number = 1
for week in travel_expenses:
    print("* week #{}: ${}".format(week_number, sum(week))
    week_number += 1

This is the error week_number += 1 SyntaxError: invalid syntax

1 Answer

Steven Parker
Steven Parker
231,268 Points

It looks like the parentheses are unbalanced on the "print" statement on the 2nd to last line.
One more closing parenthesis is needed at the end.