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

Team dxw
PLUS
Team dxw
Courses Plus Student 7,277 Points

built_in_function_or_method is not iterable

So on challenge task 1 of 4 for Python basics I have tried step one,

this code passes but fails in step 2:

full_name = "My Name Here"

name_list = list(full_name.split())

is it because I am trying to store the list manually? Should I be writing a for loop that iterates through the string, looks for spaces, stores them and then appends to an empty list?

If so I'm a bit lost as to how to do that...

Any help appreciated! I am pretty new to this coding thing

greeting_list.py
full_name = "David William Reddin"

name_list = for name in full_name:



list(full_name.split())

greeting_list = list("Hi, I'm Treehouse".split)

2 Answers

Shaun Dixon
Shaun Dixon
10,944 Points

The way I solved this was to create the initial variable and then when creating the name_list I called the full_name variable with the .split() at the end like below:

full_name = "Shaun Dixon"

name_list = full_name.split()

This would then create a list of ["Shaun", "Dixon"].

Shaun Dixon
Shaun Dixon
10,944 Points

Your welcome. It might feel a bit alien at first but stick with it, you almost had the answer yourself :)