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

Benjamin Peters
Benjamin Peters
552 Points

How on earth do I do this?

I've been watching the videos and filling out the code as he goes along, but when I get to the challenge tasks I feel woefully underprepared. I have no idea how to accomplish this. I know what he's asking me to do, but I'm not sure how to execute the task. My questions: What am I doing wrong within this challenge task and what am I doing wrong overall? Why do I feel so lost when it comes to the challenge tasks?

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

3 Answers

Kourosh Raeen
Kourosh Raeen
23,733 Points

Hi Benjamin - You can get the current item's index 0 using

item[0]

Also, remember to use == when doing comparisons. Lastly, inside the for loop start with the if statement first and then the print statement, otherwise you end up printing every item and rendering the if statement useless.

Benjamin Peters
Benjamin Peters
552 Points

Well, after tinkering with it this morning. This is what I got:

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

Kourosh Raeen
Kourosh Raeen
23,733 Points

Everything looks good except the printing part. You need to print the current item in the loop so print(items) should be print(item).