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

I don't understand this at all

Since I don't understand this at all except function can someone point me in the right direction. I think I should back track. Where should I go to learn this? I did python basics and now i am on this. I feel like this took a big jump.

slices.py
def first_4[info]:
    return info[:3]

1 Answer

Thomas Harris
Thomas Harris
7,647 Points

When defining the function, you'll need to use parenthesis instead of brackets. This is covered in the Python Basics course you're working on.

def first_4(info):
    return info[:3]