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

Heather Ketten
Heather Ketten
1,767 Points

Having trouble with a challenge task, 3/4 within Python Basics...

full_name = "first last"

name_list = full_name.split()

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

greeting_list2 = ("Hi, I'm".split() + name_list[0])

I realize there are probably issues with the fourth line of this code - that's not necessarily the problem...

The prompt on challenge 3 asks to replace "Treehouse" in "greeting_list" with the first list item from the "name_list" variable.

It seems that the issue is - if I replace things in this code for "greeting_list", it marks task 2 wrong because then task 2 has been changed?

However, it doesn't seem to understand making another variable for "greeting_list" (e.g., here I made "greeting_list2" to try the new code).

Is there something I'm not grasping?

2 Answers

It would help if you post the actual code which fails the task. I tried:

greeting_list[2] = name_list[0]

For task 3, and it still passes.

Heather Ketten
Heather Ketten
1,767 Points

OH. I see what I was missing.

I was trying to replace the word "Treehouse" with something else by rewriting the variable's definition but I did just learn about replacing values in lists, duh!!

Thanks!