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

I 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.

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

1 Answer

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

Couple issues here.

  1. 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 as a[0]=='a' instead.
  2. print a was the Python 2 way of outputting value; in Python 3, print is a function print().

hope that helps.