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 trialNico Romero
1,365 PointsSubstring not found
So its saying that it cant find a substring and I may have not written my code correctly as well. It's asking that I skip the item in index 0 is a. I don't think I specified the index correctly. Kind of a hard challenge
def loopy(items):
# Code goes here
for item in items:
if item == "Done":
break
else:
print(item)
if item.index('a'):
continue
else:
print(item)
2 Answers
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyou can use slice notation, myString[ begin : end : step ], where begin is the index you want your substring (or slice) to start, inclusive, end is the index where you want it to end, exclusive (so your slice will not include the index you put for end, but one index before it) and step is the gap between indices, so 2 would get every other index. begin defaults to 0 (the index of the first element in a sequence), end defaults to the length of the sequence (one after the index of the last element, so that the last element will be included in the slice), and step defaults to 1. so: myString[5:] is ing bobcat[:4] is bobc joe[1] is o
Nico Romero
1,365 Points Thanks James, I figured it out, I had way too much and index was wrong. Thank you!