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 trialLaknath Gunathilake
1,860 Pointscan't seem to pass the last step
I think I understand how I get the first and last 4 items separately, but I don't know how I get them in one list. Anyway's can't seem to pass this challenge
def first_4(arg):
return arg[0:4]
def odds(arg):
return arg[1::2]
def first_and_last_4(arg):
return (arg)[0:4]
return (arg) [-4:]
1 Answer
Kourosh Raeen
23,733 PointsHi Laknath - You need to have one return statement. Just concatenate the two slices with + and return it. Also, you don't need parenthesis around arg
.
Laknath Gunathilake
1,860 PointsLaknath Gunathilake
1,860 Pointsconcatenating the two slices with a + doesnt seem to work.
Kourosh Raeen
23,733 PointsKourosh Raeen
23,733 PointsYou still need to use
arg
for the second slice:Laknath Gunathilake
1,860 PointsLaknath Gunathilake
1,860 Pointsgot it..thanks