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 trial

Python Python Basics (2015) Shopping List App Continue

Debasis Nath
Debasis Nath
3,316 Points

how can i print the index number?

asking to print a index number??

breaks.py
def loopy(items):
    # Code goes here
    for items in items:
        if items(0)="a":
            continue
        print(item)

3 Answers

You need a loop to iterate on each element of items. Inside the loop you need to check the first character(index 0) of the item. If it is 'a' continue, otherwise print the item

def loopy(items):

    for item in items:
        if item[0] == 'a':
            continue
        else:
            print(item)
Sameera Sy
Sameera Sy
2,349 Points

There were certain errors in your code, plus the answer given by Erdem Meral is perfectly correct. I just want to give out another solution for it. The iterable should be item with items as the list.

def loopy(items):
    for item in items:
        if item.startswith("a"):
            continue
        else:
            print(item)

Just google for the startswith method. Should be a good thing to use here. Cheers!

Use square brackets '[]'

for item in items:
    if item[0] == "a":
        continue
    else:
        print (item)