Welcome to the Treehouse Community
Looking to learn something new?
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]