Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Tom Finch1,175 Points
Not sure what its asking here.
When I run this code outside of the challenge I get what I believe to be the correct result.
e.g if I had a list of numbers from 1 - 10 and ran it through the odds function It would return the numbers (2, 4, 6, 8, 10) with the Index being odd numbers. (1, 3, 5, 7, 9).
but in the challenge it get "Didn't get the right value for odds".
Any idea what I am doing wrong?
def first_4(items): return items[:4] def first_and_last_4(items): first4 = items[:4] last4 = items[-4:] both = first4 + last4 return(both) def odds(items): oddItems = items[1::2] return[oddItems]
Steven Parker216,136 Points
Also, "return" is not a function, so you don't need parentheses around the result either:
return both # instead of: return(both)