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 trialabdul hakkim
2,745 Pointscontinue code challenge
code challenge on continue some one can help me!!!!!!!!!
abdul hakkim
2,745 Pointstried could not figure out please help
Chris Freeman
Treehouse Moderator 68,457 PointsCan you please post the latest version of your code?
abdul hakkim
2,745 PointsThis 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
Treehouse Moderator 68,457 Pointsitems[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 afor
loop onitem in items:
- change the
if
to compareitem[0]
instead ofitems[0]
abdul hakkim
2,745 PointsThank you very much Mr.chris for your explaination and helping i got cleared challenge
tonypitkin2
Courses Plus Student 1,950 PointsI 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
Treehouse Moderator 68,457 PointsTony, 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
.
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsWhat have you tried so far? Do you still need help?