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 trial

Python Python Collections (2016, retired 2019) Slices Slice Functions

slice functions task 2

am getting the "Didn't get the right results from the function" help figure out where am wrong

def first_4 (dob):
    #dob = ['1972', '1974', '1975', '1977', '1979','1980', '1984', '1986', '1990', '1995', '1998', '20003','2008']

    return dob[0:4]

def first_and_last_4(iterable):
    new = iterable[:4]
    old = iterable[-4:]
    mix = new + old
    return ",".join(mix)

1 Answer