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 trialjvar
3,251 PointsCode works in my IDE but failed in Challenge
Hi all,
I run into this error when I check my work in challenge:
Bummer: AssertionError: '* Asia' not found in 'Asia\nAfrica\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output
However, when I copy and paste my code into my IDE(Pycharm), it works just fine. Does anyone else runs into the same issue? TIA!
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
for continent in continents:
if "A" in continent[0]:
print(continent)
4 Answers
KRIS NIKOLAISEN
54,971 PointsThis passes both tasks
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
for continent in continents:
if "A" in continent[0]:
print("*", continent)
I pasted your updated code in and it passed both tasks as well
KRIS NIKOLAISEN
54,971 PointsI haven't seen that solution before. For task 2 you also need to print a bulleted list. This is what is meant by '* Asia' not found in 'Asia'
jvar
3,251 PointsHmm...would you mind posting here what your solution was? For challenge 2 to print out bullet points, here is what my code will be. it also works fine in Pycharm:
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
for continent in continents:
if "A" in continent[0]:
print(f"* {continent}")
here is the outcome in Pycharm:
* Asia
* Africa
* Antarctica
* Australia
jvar
3,251 PointsMuch appreciated, thank you! on a side note, I just love f-string so much that I keep using it everywhere even when it's simpler not to, LOL.