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 trialRegina Ackah
2,649 PointsAssignment 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 = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
for continent in continents:
if continent[0] == "A":
print(continent)
4 Answers
Jassim Alhatem
20,883 PointsYou're completely correct. You're just missing the '*' . Just replace the print(continent)
with:
print("* " + continent)
Peter Vann
36,427 PointsHi 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!
Peter Vann
36,427 PointsHa Jassim! (You beat me!?! LOL)
You are quicker on the draw!?! LOL
Stay safe and happy coding!
Jassim Alhatem
20,883 Pointsyes sirrrrr, lol. I was trying to answer the for loop Javascript one, but you beat me to it xD. I think we're equal.
Peter Vann
36,427 PointsAnd 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
Peter Vann
36,427 PointsHeading to the store...
Jassim Alhatem
20,883 PointsI lowkey like that game xD. And That show looks jokes, I'll check it out for sure. You stay safe too :D