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 Meet Lists Indexing

MightyIronElf 14
MightyIronElf 14
1,726 Points

Unexpected Indent

I have the wishlist code typed out exactly how he wanted it, but when I go into the console to test it it tells me that I have an unexpected indent on line one. Can anybody tell me why?

books = [ "Automate the Boring Stuff with Python:Practical Programming for Total Beginners-Al Sweigart", "Python for Data Analysis", "Fluent Python:Clear,Concise,and Effective Programming-Luciano Ramalho", "Python for Kids:A Playful Introduction To Programming-Jason R. Briggs", "Hello Web App:Learn how to Build a Web App-Tracy Osborn", ] print("Suggested gift:{}".format(Books[-1])

It's supposed to be spaced out into a list but I can't get it to work. =)

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Data Analysis Techdegree Graduate 49,443 Points

Hey MightyIronElf 14 ! 👋

I'd love to help but it's unfortunately really hard to tell without seeing your code. If you're working in a Workspace on Treehouse, please create a snapshot and provide the link here so I can open up a forked version of it. It's the camera icon at the top right.

If not, could you please copy/paste your code here? If you type three backticks before and after your code, it should keep the formatting 👍

1 Answer

Steven Parker
Steven Parker
230,946 Points

Line 1 of any Python program should not be indented. If you have any spacing or tab(s) at the beginning of line 1, remove it.

MightyIronElf 14
MightyIronElf 14
1,726 Points

Thank you both @stevenparker and @travisalstrand for the answers and tips=)

Steven Parker
Steven Parker
230,946 Points

MightyIronElf 14 — Glad to help. You can mark a question solved by choosing a "best answer".   :white_check_mark:
And happy coding!