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

Adam Sullivan
Adam Sullivan
9,386 Points

Why is my second function passing before I add the third function but not after it? Could this be a problem on Treehouse

The 2nd function was approved but after creating the 3rd function it returns this " Bummer: Didn't get the right values from first_and_last_4."

def first_4(item): listed_item = item[:] for i in item: return listed_item[:4]

def first_and_last_4(item): listed_item = item[:] first_part = listed_item[:4] last_part = listed_item[-4:] last_part.extend(first_part) return last_part

def odds(iterable): odd_numbers = iterable[:] for i in iterable: return odd_numbers[1::2]

1 Answer

I couldn't get your second function to pass. The console states:

AttributeError: 'str' object has no attribute 'extend'

Adam Sullivan
Adam Sullivan
9,386 Points

Hmm ok, I didn't get that error message back and it did let me pass once with that method and then afterwards wouldn't accept it. It's helpful to see the error you got, I went back and added the two strings instead of trying to extend them. Thanks