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

attribute error

im trying to make a variable name_list as a list in task 1 of 4 python cant work it out

greeting_list.py
full_name = "chey", "pettitt"
name_list = full_name.split

2 Answers

Orestis Pouliasis
Orestis Pouliasis
5,561 Points
full_name = "chey pettitt"
name_list = full_name.split(" ")

If you want anything to be further explained, please write back. Hope I helped!

ok so if you want to split in brackets you add this in the code i get it thanks orestis

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

.split() is a method (a function that belongs to a class, in this case, the class str), and you have to call methods/functions. You call them, or activate them, with parentheses.