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!

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 (2016, retired 2019) Slices Slice Functions

Lihua Yao
Lihua Yao
4,218 Points

Make a function that accepts a single iterable as an argument. Return every item in the iterable with an even index in

why below way is not correct?


[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]

numbers[::-2] [19, 17, 15, 13, 11, 9, 7, 5, 3, 1]

1 Answer

Lihua Yao
Lihua Yao
4,218 Points

I tested in python shell, I got the correct result.