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 trialKurobe Kuro^T_T^
5,369 Pointsit doesent work help please
help
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
231,275 PointsYou'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.
Claire Beauvais Lightner
853 PointsHello,
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.
Kurobe Kuro^T_T^
5,369 Pointsthank you i soved it that you for your time
Kurobe Kuro^T_T^
5,369 PointsKurobe Kuro^T_T^
5,369 Pointssooo i need to use a print instead of a if??
Steven Parker
231,275 PointsSteven Parker
231,275 PointsYou'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).
Kurobe Kuro^T_T^
5,369 PointsKurobe Kuro^T_T^
5,369 Pointsthank you i soved it that you for your time