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
Blair Owens8,235 Points
Is there an error with Treehouse or am I getting something wrong? Make a function named odds that accepts an iterable
I'm having trouble with this question. It say's it expected "kaoa", I'm not sure where that combination of letters came from and even when I change my code to make that the output, I get another error saying. "Where's odds()?"
Make a function named odds that accepts an iterable as an argument and returns the items with an odd index in the iterable.
odds() didn't return the right output. Got [1,3,5], expected kaoa
def odds(list2): list2 = [0,1,2,3,4,5] odds = list2[1::2] return odds
Delete the line that says:
list2 = [0,1,2,3,4,5]
This line is redefining the list. You want the list that is passed in as a parameter to be the list that has its odd values returned.
def odds(list2): return list2[1::2]