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 trialAnthony Macias
11,220 Pointsstuck on list challenge
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!
6 Answers
Michael Nickey
Courses Plus Student 13,524 PointsSo.... what's your question?
name_list --> this should equal the first, middle and last name as list elements. However you shouldn't just type them in. That's so 1980's.
Check this out and see if you can apply it to your full_name variable.
<pre>
>>> word = "This is some random text"
>>> words2 = word.split(" ")
>>> words
['This', 'is', 'some', 'random', 'text']
</pre>
Caleb Viola
5,694 PointsYou can use the split() method on your full_name variable.
Tony Brackins
28,766 Pointsfull_name = "Full Name" name_list = full_name.split(" ")
Anthony Macias
11,220 PointsThank you.
Mark Long
15,763 PointsThe first challenge passed with:
full_name = "Steven Mark Long" name_list = full_name.split(" ")
Then when I attempted to answer the second challenge I received a message that says "Oops! It looks like Task 1 is no longer passing."
What gives?
Daniel Chan
11,787 PointsYes you can do it simply like this:
full_name = 'Firstname Middlename Lastname'
name_list = ' '.split(full_name)
>>>name_list
['Firstname', 'Middlename', 'Lastname']
Aman Kumaran
2,314 Pointsyou have used the wrong code, that type of code is for join, not split :)
Aman Kumaran
2,314 Pointsyou have used the wrong code, that type of code is for join, not split :)
Aman Kumaran
2,314 Pointsyou have used the wrong code, that type of code is for join, not split :)