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 trialkushagra jain
Courses Plus Student 2,563 Pointschallenge task 1of 4
first_4 problem
def first_4(first):
first[0:4]
return first
2 Answers
Alexandra Barnett
Front End Web Development Techdegree Graduate 46,473 PointsHi Kushagra! You almost have it! When you sliced the iterable, you didn't assign it to a variable before returning so, you can either assign the slice to a variable and then return the variable or return the slice like so:
def first_4(iterable):
a_variable = iterable[0:4]
return a_variable
def first_4(iterable):
return iterable[0:4]
Hope this helps! Let me know if you have any questions :)
kushagra jain
Courses Plus Student 2,563 Pointsplease give me hint of task 2 please!!