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

problem iterating through the travel expenses list

This is my code:

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, sum(week))
          week_number += 1

# and this is the error i'm getting:
# File "expenses.py", line 10                                                                    
#   week_number += 1     

2 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 48,723 Points

You are missing a parenthesis in your second print statement and week_number += 1 is indented too much.

Thank you for the help but the other problem I've encountered is that the week_number doesn't print a numeric value next to "#" .

MICHAEL FOWLER
MICHAEL FOWLER
921 Points

The reason you are not seeing a numeric value next to # is because your in the second print statement should be format(week_number. You have format(week,