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

Kent Utomo
Kent Utomo
652 Points

unable to answer this question

please help me

greeting_list.py
full_name = "George Clooney"
name_list = full_name.split()
greeting_list = "Hi, I'm {}".format name_list.split()
greeting_str = "Hi, I'm George Clooney"

3 Answers

Giacomo Alberini
Giacomo Alberini
9,548 Points

Well I want to help you, but I'm missing the problem.

Where did you get lost? What's the issue with your code? What do you want to achieve with that script?

Cheers,

g.

I see a few mistakes right off the bat.

Firstly, what exactly is the question you are trying to solve? That will help explain step by step what to do.

full_name = "George Clooney"  #variable defined as "George Clooney"
name_list = full_name.split()  #Split the variable into "George" and "Clooney"
greeting_list = "Hi, I'm {}".format name_list.split() #variable is defined, missing parenthesis: .format(name_list.split()) 
greeting_str = "Hi, I'm George Clooney" #not sure what this line is for ? it defeats the purpose of the previous line. you may want to add here: print greeting_list

let me know if you need anything else clarified

I'm going to try to help you out by writing out what each step results in.

# you made a variable named "full_name" with a value of "George Clooney"
full_name = "George Clooney" 

# you split the name using the .split() method. Now name_list is a list that holds ['George', 'Clooney'] 
name_list = full_name.split()

# Now you want to plug in the name list but you split the name_list again. You also only have one placeholder, so that only the first index would be available to be placed in the greeting list. The format method needs to be as followed ".format(variable_here)
greeting_list = "Hi, I'm {}".format name_list.split()

# You made another variable. You could use format like this: "Hi, I'm {}".format(full_name)
greeting_str = "Hi, I'm George Clooney"

Hope this helps!