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 trialLuis Martinez
5,986 PointsI can't figure out the second task can anyone help?
I've tried just about everything I came across the web and nothing works! Please help
1 Answer
csr13
33,293 PointsHola Luis,
You need to iterate through the list with a LOOP, fun.
for _ in continents:
print('* {}'.format(_))
For the second step, well hmmm, yas, theres two ways I can think of you can do this!
You could ... say... use indexes.
for _ in continents:
if _[0] == 'A': print('* {}'.format(_))
BTW the previous snippet is the same as this:
for _ in continents:
if _[0] == 'A': print( '* %s' % (_))
Keep in mind that str has methods, so, you can ALSO use the str.startswith() function like this!!
for _ in continents:
if _.startswith('A'):
print('* {}'.format(_))
else:
continue
Happy bug hunting!