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 trialHassan Baukman
2,288 PointsI keep getting "Didn't find the right items being printed" error message. My code works in Workspaces. Need Help.
I ran my code in the Workspaces and it seems to work. I don't know why I keep getting "Didn't find the right items being printed." The code should check for the letter "a" in the first item, if it finds it continue to the next item and print that item. If it does not find an "a" as the first letter in the first item print the current member. My code does that. Where am I going wrong here???
def loopy(items):
items=["abc","xyz"]
for item in items:
if item[0] == "a":
continue
print(item)
if item[0] != "a":
break
print(items[0])
1 Answer
Steven Parker
231,236 PointsThere's a few issues here:
- the "items" will be passed to the function, you should not set them with a literal
- the
break
statement ends the loop prematurely - the second "if" isn't needed as the item has already been printed