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 trialAbdullah AlBeirouti
2,057 PointsMy code is correct, but it's telling me to try again :s
The last part of the question is telling me to return even indices in reverse. This is actually what my function "reverse_evens" is doing, but I don't know what's wrong!
def first_4(iter):
return iter[:4]
def first_and_last_4(iter):
return iter[:4]+iter[-4:]
def odds(iter):
return iter[1::2]
def reverse_evens(iter):
if len(iter)%2 == 0:
x=iter[-2::-2]
esle:
x=iter[-1::-2]
return x
2 Answers
Grigorij Schleifer
10,365 PointsHi Abdullah, I see a typo in the reverse_evens method. Can you spot it?
Grigorij Schleifer
10,365 PointsHey Abdullah, it is so easy to make a lot of silly mistakes. Finding them is fun and teaches you a lot. Keep up the good work.
Cheers,
Grigorij
Abdullah AlBeirouti
2,057 PointsAbdullah AlBeirouti
2,057 PointsOh no, the else :( Thank you so much!