Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (Retired) Shopping List Lists and Strings

Not sure how this can be wrong for the Challenge Task 3 of 4 in python

I followed the direction and added the code line and i keep getting an error. I've tried it in a python ide and it works fine. i just can't figure out what part of the instructions i am missing.

greeting_list.py
full_name = "pedro surillo"
name_list = full_name.split()
greeting_list = "Hi, I'm " +name_list[0]

4 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Pedro;

Welcome to Treehouse;

For Task 3 of this challenge we are wanting to change out something in our greeting_list from Task 2, not alter the code from Task 2.

change "Treehouse" in greeting_list to the first item in your name_list variable.

"Treehouse" resides at index 2 in our greeting_list string and our name_list first item resides at index 0, correct?

How could we add another line of code that would change "Treehouse" to be equal to "Pedro", in this case?

Post back if you are still stuck.

Ken

Hi Pedro,

If you use list functions, you can pass this challenge. Your do really get correct output, but the goal of this challenge is to test the usage of python list.

full_name = "David Lee"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split()
greeting_list[len(greeting_list)-1] = name_list[0]

Sincerely,

Thanks both of you!! I know see what i was doing wrong. I need to stop rushing thru the questions. Thanks again for very quick responses.

Artjom Dzug
Artjom Dzug
8,238 Points

Can someone explain all of this? because i really don't understand why is that correct, like totally...