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

what does this error in treehouse practice challenge mean first task is not passing

why am i not able to clear the task with my code

slices.py
def first_and_last_4(word):
    word1 = word[0:4]
    word2 = word[-4:]
    word3 = word1 + word2
    return word3

I am not sure why. I tested your code in my machine and it produced the results I expected.

1 Answer

Steven Parker
Steven Parker
229,744 Points

Did you see the notice that said "Important: In each task of this code challenge, the code you write should be added to the code from the previous task."?

It looks like you may have accidentally removed the function you had made for task 1 while working on task 2. The new function itself seems OK.

Good point!