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 trial

Python Python Basics (Retired) Shopping List Lists and Strings

Michael Rawlinson
Michael Rawlinson
1,507 Points

Python basics task 1 of 4 lists

It gives me an error saying the name_list does not match my name? Question is : 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!

greeting_list.py
full_name = "Richard Grinch"
name_list = list(full_name)
Christian Kuylen
Christian Kuylen
3,176 Points

Using the list command will make a list out of each letter. What you're doing is making a list that looks like: [R, i, c, h...] and so on.

For this task, you need to use the .split() function on your name variable. By default, .split() will create a list out of the string using spaces or tabs as new items in the list.

Hope this helps!

1 Answer

Jeffrey Ruder
Jeffrey Ruder
6,408 Points

You need to use the .split method.

name_list = full_name.split()