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 trialsonam rathore
703 Pointswhat will be the solution to this task?
how can the function be defined for carrying out this last step?
def first_4(arg):
arg=list(range(10))
return(arg[1:5])
def odds(arg):
return(arg[1::2])
1 Answer
Script Code
6,631 PointsRemember that python is all about simplicity. You passed the second challenge so you should be able to figure this one out by yourself. Does it make sense or do you require additional explanation?
def first_and_last_4(iterable):
return iterable[:4] + iterable[-4:]