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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Praise Mupani](https://secure.gravatar.com/avatar/c3c24fff2bcc38d14989042581f8de7f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Praise Mupani
1,811 PointsWhy I am getting an AssertionError on this code ?
I am getting an Assertion Error on this code. Can you please help me out?
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code herecontinent = 0
for x in range(0,2) :
print("* ",continents[x])
3 Answers
![Praise Mupani](https://secure.gravatar.com/avatar/c3c24fff2bcc38d14989042581f8de7f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Praise Mupani
1,811 PointsThanks this finally did the trick continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ]
Your code here
for cont in continents : print("* " + cont)
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe instructions ask you to print a list showing each continent, but this code will print only the first 2.
Hint: instead of using "range", this might be a good opportunity to use the list variable itself to control the loop.
Also be aware that code added to a comment line will be ignored (but isn't needed in this case).
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsNote that the "should look similar to" example is just to illustrate the formatting and not intended to be the complete result set.
![Praise Mupani](https://secure.gravatar.com/avatar/c3c24fff2bcc38d14989042581f8de7f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Praise Mupani
1,811 PointsThanks, Steven may I am getting it all wrong, first, i did the below
for continent in continents : print("*", continent)
and I got the same Assertion error. Then looked on top of the question and I saw the required result as ,
- Asia
- South America that is why I used range to print only two elements of the list
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThis should have been correct for task 1 (always use Markdown formatting when posting code):
for continent in continents:
print("*", continent)