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 trialWilliam Bailey
4,585 PointsThis code works. why no passy pal?
The code below will return the first four items of whatever iterable is given to it and just pass anything not iterable. Is this challenge bugged?
# return 1st four items from iterable
def first_four(iterable):
try:
return(iterable[:4])
except TypeError:
pass
1 Answer
Steven Parker
231,236 PointsYour function has the wrong name.
The challenge asks you to create a function named first_4, but your function is named first_four. Just give it the correct name to pass.
As a general hint about challenges, it's a good idea to follow the instructions closely, and not improvise and add extra features. While it causes no problem here, in other challenges it may prevent your program from passing.
William Bailey
4,585 PointsWilliam Bailey
4,585 Points(Face-palm). Thanks Steven.