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 trial

Python Python Collections (Retired) Slices Slice Functions

Make 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

slices.py
def first_4(happy): 
    return happy[:4]

def odds(confusion):
    return confusion[::3]

Thanks Joshua i appreciate the help

3 Answers

Your 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.

def odds(confusion): return confusion[1::2]

Try this

  def odds(whatever):
    return whatever[1::2]