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 trialprateekmahesh
5,454 PointsI need some help in this task
I have no clue about solving this problem. But I know how to do it mentally but writing the correct logic for this question is tough for me.
def loopy(items):
# Code goes here
for a in items:
if a.index(0)=="a":
continue
else:
print a
1 Answer
William Li
Courses Plus Student 26,868 PointsCouple issues here.
-
list.index()
this method doesn't quite work like that; for example, list.index(value) will return the index position of the value on the list; thus, you need to write the comparison asa[0]=='a'
instead. -
print a
was the Python 2 way of outputting value; in Python 3, print is a functionprint()
.
hope that helps.