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 trialMaksym Biednov
13,459 PointsProblem with challenge odds function
The task is "Make a function named odds that accepts an iterable as an argument and returns the items with an odd index in the iterable." It should be very simple, but somehow It doesn't work for me.
my code is
def odds (li):
li = list(range(56))
return li[1::2]
(sorry for editing. I've tried '''python ''', but it still looks the same)
I got Bummer: "odds()
didn't return the right output. Got [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55], expected kaoa"
What's wrong with it? What is "kaoa"? As for me, odds return odds.
Joy Kesten
Treehouse Guest TeacherJoy Kesten
Treehouse Guest TeacherI hope you don't mind, I fixed your code. Chalker's video on the side of the forum shows you how for future reference :)
keep up the good work!