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 trialzoltans
2,547 PointsI have stuck with printing out countries beginning with "A". Please, help!
I have no idea how to the second task. I have rewatched Craig's videos, just in case I have missed something. but couldn't find a way to solve this task.
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
for cont in continents:
print("*", cont)
5 Answers
KRIS NIKOLAISEN
54,972 PointsThe assertion error states : '* Asia' not found in 'Asia' . You are missing the bullet.
Efaz Khan
5,194 PointsHi @zoltans , you can use a for loop to iterate through the list and check if the first letter starts with 'A'. First letter of a word can be accessed by cont[0]
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
for cont in continents:
if cont[0] == 'A':
print(cont)
Efaz Khan
5,194 PointsThis code should work
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
for cont in continents:
if cont[0] == "A":
print("* " + cont)
zoltans
2,547 PointsBummer: AssertionError: '* Asia' not found in 'Asia\nAfrica\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output It still isn't giving me the pass. Do you know why?
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
for cont in continents:
if cont[0] == "A":
print(cont)
zoltans
2,547 PointsThanks a lot you guys!