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 Basics (2015) Python Data Types Splitting and Joining

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

What is list(5)?

What exactly is list()? A method, a function? Another way to define a list? I'm confused, as Kenneth uses it as we talked about it before in the videos - maybe I wasn't paying attention.

1 Answer

Daniel L.
Daniel L.
10,837 Points

list(5) is just showcasing how you can't turn one integer into a list because it's only got one thing in it.

Now a string, like: 'hello' you can make into a list.

All list() does is split up whatever's inside and turns it into a list so:

list('hello')
['h', 'e', 'l', 'l', 'o']

Hope that helps :)