Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Oscar Caraballo
324 PointsCreate a variable named full_name that holds your full name. Make another variable named name_list that holds your full
Create a variable named full_name that holds your full name. Make another variable named name_list that holds your full name as a list, split on the spaces. Don't create name_list manually!
any suggestions? Thx
full_name = "peter gabriel"
name_as_list = list(full_name)
name_list = name_as_list ''.split(name_as_list)
1 Answer

Chris Shaw
26,650 PointsHi Oscar,
To create a list using the full_name
variable you simply just need to pass a string to the split
method which consists of a space.
full_name = 'peter gabriel'
name_list = full_name.split()
EDIT: updated as per Mr. Loves comment below :)
Happy coding!
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest Teacher.split()
will actually split on spaces (and tabs and new lines) by default, no arguments required!Chris Shaw
26,650 PointsChris Shaw
26,650 PointsThanks Kenneth Love, it's been a couple of months since I used Python, time for a refresh me thinks.