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

Assignment gives an Error .

This is the code for Challenge2 in the PythonLists series. I believe the code is correct but i get an error .

the assignment is to simply pring out countries begining with the letter A. is there a problem with my code??

continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] for continent in continents: if continent[0] == "A": print(continent)

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
for continent in continents:
    if continent[0] == "A":
        print(continent)

4 Answers

Jassim Al-Hatem
Jassim Al-Hatem
20,442 Points

You're completely correct. You're just missing the '*' . Just replace the print(continent) with:

print("* " + continent)

Hi Regina!

Your logic is correct, but on your second task you are leaving out the "bullet points" ('* ') when you print.

This passes:

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
for continent in continents:
    if continent[0] == "A":
        print('* ' + continent) # You weree missing the * and space

I hope that helps.

Stay safe and happy coding!

Ha Jassim! (You beat me!?! LOL)

You are quicker on the draw!?! LOL

Stay safe and happy coding!

Jassim Al-Hatem
Jassim Al-Hatem
20,442 Points

yes sirrrrr, lol. I was trying to answer the for loop Javascript one, but you beat me to it xD. I think we're equal.

And evidently, you are a. good sport, too!?! LOL

Hey not sure where you are located, or what TV is available to you, but I've been telling everyone about Resident Alien on the Sci-Fi channel. It is SOOOOOOO funny (they just aired the 9th episode)!!!

More info:

https://www.syfy.com/syfywire/syfy-renews-resident-alien-for-season-2

Also, something fun - my quirky take on the classic "Simon Game" coding challenge:

https://codepen.io/petrovnikov/full/MXxQPx

Again, stay safe and happy coding!

:D

Heading to the store...

Jassim Al-Hatem
Jassim Al-Hatem
20,442 Points

I lowkey like that game xD. And That show looks jokes, I'll check it out for sure. You stay safe too :D