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

RM Hrdr
RM Hrdr
3,491 Points

first_and_last_4 issue

HI Team Treehouse,

I've tried to test my code with atom and it's working to produce the output but when I hit "recheck work" in the coding challenge workspace it's throwing "Bummer: Couldn't find first_4".

Any guidance would be appreciated, thank you!

slices.py
x = list(range(20))

def first_and_last_4(x):
    first_4 = x[:4]
    last_4 = x[-4:]
    pieces = (first_4 + last_4)
    return(pieces)
Leo Marco Corpuz
Leo Marco Corpuz
18,975 Points

I thinks it's because you modified the first_4 function on the first task in order to complete this task? You need to create a new function for the second task. Also your function argument can just be x. There's no need for a value. Hope this helps.

2 Answers

RM Hrdr
RM Hrdr
3,491 Points

Thank you Zach that link was helpful.

Leo, somewhat I've realised I've deleted the first_4 function that's why the grader was looking for it I've reloaded the first_4 function together with the first_and_last_4 and was able to get it done.

Thank you for all the inputs!