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!
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
Benjamin Harris8,872 Points
List items from a list that start with a certain character?
I am having trouble with this one. What have I done?
continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia'] # Your code here new_continents =  for continent in continents: if continent.startswith('a'): new_continents.append(continent) for new_continent in new_continents: print("* " + new_continent)
Viraj Deshaval4,874 Points
Try to use this with slices. So you first need to find the first element of each word starts with a. You can do it using slices and it works as below: continent == 'A' and then append in a list with '*' as a prefix. Try it out and let me know if you still require help. Happy to help
Philip Schultz11,437 Points
Hello, the first step is asking you to print a list of all of the continents.
for continent in continents: print("*",continent)
for the second step it wants you to only print the continents that begin with the letter 'A'. So all you need to do is check the first character of each index with an if statement. Remember that a string is iterable and you check each character using indexes.
for continent in continents: if continent == 'A': print("*",continent)
****** you don't need two for loops just add the if statement to the first for loop.******