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

Edgar Vaquerano
Edgar Vaquerano
1,254 Points

It think there's something wrong with your checker for challenge 4/4:

It think there's something wrong with your checker for challenge 4/4: answer: def reverse_evens(num): return num[-1::-2]

does return [5,3,1]

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

def first_and_last_4(num):
    return num[:4]+num[-4::1]

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

def reverse_evens(num):
    return num[-1::-2]

2 Answers

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hi Edgar.

I am not really sure what the first -1 would mean in this case. But I think for this part it is easier to split the task in 2 steps inside the function. First get the even indexed values and then reverse the order. This will make things much easier! If you got to this point (part 4/4), I'm sure you can do it. ;)

Vitto

Ker Zhang
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Ker Zhang
Full Stack JavaScript Techdegree Graduate 29,113 Points

i ran into same problem. The following code words in my Terminal without any problem but the challenger checker keeps reporting error.

def reverse_evens(v): print(v[::-2]) return v[::-2]