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

Martel Gaines
Martel Gaines
1,957 Points

My full name entered as a list variable

I'm having an issue with inputting my full name as a list function for name_list variable. I'm currently performing the following action: name_list = list("Martel," "Gaines") or using the existing variable of full_name = "Martel Gaines as name_list = list(full_name)

I'm being returned an error that my name does not match my full name. Has anyone been stuck on this challenge?

greeting_list.py
full_name = "Martel Gaines"
name_list = list("Martel Gaines")

1 Answer

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

In your code, the value of name_list would becomes

# => ['M', 'a', 'r', 't', 'e', 'l', ' ', 'G', 'a', 'i', 'n', 'e', 's']

What the challenge is expecting the name_list to be is ["Martel", "Gaines"]

Hint: Use the .split() method on the string.

Martel Gaines
Martel Gaines
1,957 Points

Thanks Will, much appreciated! The .split() method resolved it all along.