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!
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
Chris FreemanTreehouse Moderator 68,404 Points
Challenge question error message seems wrong
In Shopping List Stage 4, Challenge Step 3 of 4: Almost done! Now, change "Treehouse" in greeting_list to the first item in your name_list variable.
I believe my code is correct, but still getting error message. Using Preview to check the output.html it seems the error message is incorrect.
EDIT: I see that
greeting_list with the extra 'from' is not exactly as stated in Step 2. However, when including the extra word, the code passes Step 2, perhaps due to relaxed validation. Given passing code in Step 2, the error seems misplaced since the instructions for Step 3, only say to change a
greeting_list list item not regarding the specific position of "Treehouse".
Suggestion to Treehouse Developers: Change Step 2 to verify
greeting_list = "Treehouse" or in Step 3 allow for
greeting_name[-1] == name_list
full_name = "Chris Freeman" name_list = full_name.split() greeting_list = "Hi, I'm from Treehouse".split() greeting_list = name_list
Variable Value greeting_list ['Hi,', "I'm", 'from', 'Chris'] input __name__ __main__ full_name Chris Freeman name_list ['Chris', 'Freeman']
But I get the error when checking work:
name_list's first item doesn't seem to be in your
Looking at the output.html, the first item from name_list ('Chris') is clearly in my greeting_list in the place of the original 'Treehouse'.
Looking to Kenneth Love for feedback! (See EDITs above)
Here is the answer for part 4/4:
full_name = "Chris Freeman" name_list = full_name.split() greeting_list = "Hi, I'm Treehouse".split() greeting_list = name_list
what this is doing is taking your full name then it splits it into "Chris" and "Freeman"
greeting_list is split into "Hi" "I'm" "Treehouse"
take index spot 2 (which is "Treehouse" start counting at 0. 0 = Hi, 1 = I'm, 2= Treehouse) and change index spot 2 to name_list index spot 0 (0="Chris")
Hope this helps! please mark for best answer if it helped!!
Xiaoqian Zhou6,506 Points
I think this question is asking for a for loop that checks each list item and if it's "Treehouse" then change it to name_list...
Thomas Kirk5,246 Points
The task asks for "Hi, I'm Treehouse", not "Hi, I'm from Treehouse"
As such, there is no greeting_list