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 Continental

it doesent work help please

help

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
print("Continent: {}".format(continents[0]))
for continent in continents:
    print("* " + continent)
if continents[0] == "A":
    print("* " + continent)

2 Answers

Steven Parker
Steven Parker
229,732 Points

You're kind of close. But your "if" must be indented if you want it to be considered to be inside the loop. And you'll only need one "print" statement.

sooo i need to use a print instead of a if??

Steven Parker
Steven Parker
229,732 Points

You'll need both for task 2. If you have already completed task 1, you should be able to pass task 2 by adding an "if" to control your existing "print" statement (and adjusting the indentation appropriately).

thank you i soved it that you for your time

Hello,

Great job on your Python learning,

So here we want to iterate over the array continents and then print each continent with an asterisk. You have the solution already line 2 and 3 of your code are enough and will solve the first part of the problem.

For the second part of the problem. Before to print anything we want to check to see if the continent we are looping over starts by an "A". So for this part, we will use only the lines 2,3 and 4 of your code and we will move line 4 (the if statement/checking state) before line 3.

thank you i soved it that you for your time