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 trialGokul Ravichandran
209 Pointsname_list query
name_list query
full_name="gokul pradeep"
name_list=list(full_name).split()
2 Answers
Bryan Laraway
13,366 PointsI'm assuming you are on Task 1 for the challenge. The issue here is that you don't need to declare full name as a list, as the .split() function will return the words as a list.
full_name="gokul pradeep"
name_list=full_name.split()
Chris Freeman
Treehouse Moderator 68,457 PointsThe issue in your current code is a list
object does not have a method .split()
. Strings have the method split()
which returns a list
of the split items. The default split is on whitespace.
Removing the list()
wrapper from around full_name
will fix this:
full_name = "gokul pradeep"
name_list = full_name.split()
In terms of style, in an assignment statement it is customary to add a space
on both sides of an equals (=) sign
David Yao
116 PointsDavid Yao
116 PointsDo you have a question tied to this?