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

What are they asking me for in this challenge?

I don't understand the instructions of this challenge very well, are they asking me to return the value of any odd index item in the iterable?

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

def odds(opa):
  return 

1 Answer

Hi Wilfredo,

It wants all odd indices returned. For example, if the string "Hello" was passed in then it should return "el" which are the characters at indices 1 and 3 respectively.

This video and the teacher's notes below it should help if you're not sure how to slice the iterable to achieve this.

https://teamtreehouse.com/library/python-collections/slices/slicing-with-a-step