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

Error Msg: Your `name_list`'s last item shouldn't be in your `greeting` variable! Type word for word example Task 4 of 4

Followed numerous examples from the Python forum. Console still views my task 4 as an error. However, the Python Idle 3.4.1 on my PC displays the code as correct.

full_name = "Marky Mark"
name_list = full_name.split()
greeting_list = "Hi, I'm Treehouse".split()
greeting_list[2] = name_list[0]
greeting = " ".join(greeting_list)

2 Answers

William Li
William Li
Courses Plus Student 26,868 Points

Hello, Mark Tan

ummm ... That's kinda odd, I don't see any problem with this code either, but the code challenge indeed throws error

:x: Bummer! Your name_list's last item shouldn't be in your greeting variable!

Not sure why, may be a bug in the grader? cc Kenneth Love

Update: So I gave it another try, by changing the full_name variable to full_name = "Mark Tan", and everything work without problem. Looks like the grader is only upset about the name Marky Mark.

William, I appreciate the quick reply. Thank you.

William Li
William Li
Courses Plus Student 26,868 Points

no problem, hope you are able to pass the challenge now.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

It looks like the grader is using a re.search for the last name in the output instead of a match. A re.match() would be a better check, or at least a re.search() with word boundaries.

Mark Tan should get a bounty for finding this bug! Great find.