Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Introducing Lists Using Lists Continental

I am unable to solve this quiz or know where to start.

I am unable to recollect how to print specific objects in a list. Please help with a detailed solution, thanks.

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 68,239 Points

Hey Kanha Kesarwani, for an example of how to loop and print items in a list, review the previous video near time 2:20.

If you issue is how to only print certain items from a list, then you'll need to filter the items. A good way to do this is using an if statement. if looping with a loop variable "continent", and continent is a string, then code below would be helpful

if continent.startswith("S"):
    # add action here

This is equivalent to:

if continent[0] == "S":
    # add action here

Post back if you need more hints. Good luck!!