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 trialShadow Skillz
3,020 PointsMake a function named odds that accepts an iterable as an argument and returns the items with an odd index in the iterab
having an issues with this challenge can't figure out what I'm missing pls help
def first_4(happy):
return happy[:4]
def odds(confusion):
return confusion[::3]
3 Answers
Joshua Edwards
52,175 PointsYour odds function is jumping by too much. You want to start at index 1 the first odd number, and go through all the other odd numbers which are 2 steps after the previous odd number each time.
Ben Wong
19,426 Pointsdef odds(confusion): return confusion[1::2]
Theodore Karropoulos
22,149 PointsTry this
def odds(whatever):
return whatever[1::2]
Shadow Skillz
3,020 PointsShadow Skillz
3,020 PointsThanks Joshua i appreciate the help