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 trialPatrick Wheat
2,641 PointsNot sure what I should be using to get my name_list to print just the space between my first and last name.
Right now it is putting spaces between all of my letters instead of just in between my first and last name, should I be using the str.join in this question
full_name = ('Patrick Wheat')
name_list = list(full_name)
1 Answer
Robert Richey
Courses Plus Student 16,352 PointsHi Patrick,
Calling list()
passing in a string will create a list where each element is a single character. Instead, we want to use the split()
method.
Make another variable named name_list that holds your full name as a list, split on the spaces.
It can help to experiment with a Python REPL.
Hope this helps,
Cheers
Patrick Wheat
2,641 PointsPatrick Wheat
2,641 PointsRobert, Thanks for the clarification and the code in an example. I get it better than I did from the class now that I see it formatted that way! Great answer, appreciate the help.