Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Shopping List App Second Shopping List App

abdul hakkim
abdul hakkim
2,745 Points

continue code challenge

code challenge on continue some one can help me!!!!!!!!!

Chris Freeman
Chris Freeman
Treehouse Moderator 68,082 Points

What have you tried so far? Do you still need help?

abdul hakkim
abdul hakkim
2,745 Points

tried could not figure out please help

Chris Freeman
Chris Freeman
Treehouse Moderator 68,082 Points

Can you please post the latest version of your code?

abdul hakkim
abdul hakkim
2,745 Points

This is my latest try:----

def loopy(items):
    # Code goes here
    while True:
        if items['0']=='a':
            continue
        else:
            print(items)

[MOD: added ```python formatting -cf]

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,082 Points

items[0] is the first item in the input list and not the first character of a given item.

Under what condition does the while loop exit?

  • change the while loop to a for loop on item in items:
  • change the if to compare item[0] instead of items[0]
abdul hakkim
abdul hakkim
2,745 Points

Thank you very much Mr.chris for your explaination and helping i got cleared challenge

I was trying to do the above but was attempting to use the index function. Was I reading way too much into it? Above I see you just used:

def loopy(items):
    for item in items:
        ***if item['0']=='a':*** <---This line
            continue
        else:
            print(item)

Is this the basic format for finding items as a certain index value?

if item['IndexValue']=='DesiredCharacter'
Chris Freeman
Chris Freeman
Treehouse Moderator 68,082 Points

Tony, indexes into lists should be an integer, not a string.

The form using a string item['key'] is used to look up values in the item dict.