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 Sequences Sequence Iteration Iterating with Enumerate

Bobur Azimov
Bobur Azimov
2,547 Points

TabError: "groceries.py", line 6 index+=1 for some reason i cant make it

i have an error on python example. groceries .py

groceries = ['roast beef', 'cucumbers', 'lettuce', 'peanut butter', 'bread', 'dog food']

index = 1 for item in groceries: print(f'{index}. {item}') 6.line index+=1

Maybe this might help. Check the tabulation in your code

https://stackoverflow.com/questions/46742998/taberror-in-python-3-function?rq=1

Steven Parker
Steven Parker
231,236 Points

We can't check the indentation unless you use Markdown formatting to preserve the code appearance.

Valentin Fezza
Valentin Fezza
18,178 Points

What's that 6.line doing there?

1 Answer

Valentin Fezza
Valentin Fezza
18,178 Points

There's a piece of code ("6.line") in the middle of your print function that seems out of place...