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 trialAkhil Dogra
444 Pointsunable to find mistake
unable to find the mistake i even ran it in the idle it is running without any error
def loopy(items):
# Code goes here
for item in items:
if item == "a":
if items[0]=='a':
continue
print(item)
1 Answer
Steven Parker
231,248 PointsI see two issues:
- You have an extra test that doesn't make sense (
if item == "a":
) (remove it and fix indents) - You want to check the 0 index on each item, not the whole list of items (
if item[0]=='a':
)
Akhil Dogra
444 PointsAkhil Dogra
444 PointsYour second point is not clear to me. When i am only using the condition(if item[0]=='a'),it is confusion for me because item is not a list but a variable which takes only some designated value as if we print(item) after this process it will only give us the last element of our list. And what is the mistake in the code ,I am taking the condition if item == that element and taking that condition i am verifying whether or not its index in the list is zero or not.