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 trialIra Salem
10,331 PointsWhat am I doing wrong?
Can anybody tell me what's wrong with this code?
full_name = "Ira Salem"
name_list = list(full_name)
2 Answers
William Li
Courses Plus Student 26,868 PointsHi, Ira, you need to use the split method to solve this problem
name_list = full_name.split(" ")
The when you call the list on a string, in your case, list(full_name)
, it'll return a list by split the string character by character ['I', 'r', 'a', ' ', 'S', 'a', 'l', 'e', 'm']
. That's not quite what the question is asking for.
Ira Salem
10,331 PointsIt's crazy but I don't recall him ever showing that we could even use the .split method that way. Either that or I'm not taking very good notes. Thanks anyway. I'll give it a try soon as I get home.
Kenneth Love
Treehouse Guest TeacherHey Ira Salem. It's a couple of videos back but we definitely used .split()
on a string.
Ira Salem
10,331 PointsPerhaps I should utilize the transcript portion more. I'll definitely go back and look.
Ira Salem
10,331 PointsIra Salem
10,331 PointsCreate 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!