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

Jake Wengroff
Jake Wengroff
3,947 Points

Can't split a string

I do not understand why this is not the correct code here. The greeting_list variable is properly split, yet it's throwing me an error. Please let me know what is wrong. Thank you.

greeting_list.py
full_name = "Jake Wengroff"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse"
greeting_list.split()

3 Answers

Close! Try this:

full_name = "Jake Wengroff"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split()

p.s. I think the issue here is that you are creating the greeting_list variable as a string, and the grader/work checker is seeing the variable as a string instead of a list. If you instead split the string directly while creating the greeting_list variable, it should pass Task 2.

Jake Wengroff
Jake Wengroff
3,947 Points

I actually got it to work soon after I submitted this question:

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

Thanks nonetheless!

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