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.
hi..how do you add your name on a list on python
Cristian Altin12,165 Points
The split() function applied to a string generates a list for you by separating items at every space within the string (default behaviour). Just an extra note: list items won't contain any spaces when you use it
I also suggest to re-watch videos when you don't feel like you got something since the exercises build up on things you learned in the previous videos.
Gavin Ralston28,770 Points
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!
So, the first step would look like so:
full_name = "My Name"
The second part of the challenge is to take that variable full_name and its content up by using the space character as the delimiter (the character to split strings with) and then store that in a new variable called name_list
There's a handy string method called split which should help with that, and this video has a demonstration of that at around the three minute mark.