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

Please can someone help? It says my name_list does not match my name

I've attached the script to hopefully show you what I mean

greeting_list.py
full_name = "Nick Jordan"
name_list = [full_name]
for each in name_list:
  each.split()

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

You need to split your name into name_list. What you have right now puts name into the first spot in your list name_list and then does a loop over that list, calling .split() on whatever's there. Since that .split() isn't assigned to anything, it's immediately discarded.

How can you do the .split() on line 2? You won't need square brackets at all.

Thanks Kenneth

I have since come up with this

full_name = "Nick Jordan" name_list = full_name.split() print(name_list)

Great course by the way