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

Anthony Martinez
Anthony Martinez
13,111 Points

Can't pass challenge "task 1 is no longer passing"

I can't pass the "Shopping List" challenge regardless of what I do. I'll clear steps 1 and 2, but regardless of whatever code I enter into step 3, an error comes up and says

"Oops! It looks like Task 1 is no longer passing".

Anyone know how to advance?

1 Answer

Few things you should remember are

  • splitting,
  • indexing and
  • joining.

SPLITTING

On line two and three of below code snippet I split the full_name variable's value and "Hi, I'm X" by using a function called split(). By default, split() splits by white space.

INDEXING

On line four, I use indexing to insert a value(name_list first value) to the last position of greeting_list.

JOINING

On line five, I joined them using join().

CODE SNIPPET

full_name = "Karthikeyan Palaniswamy"
name_list = full_name.split()
greeting_list = "Hi, I'm X".split()
greeting_list[2]=name_list[0]
greeting = " ".join(greeting_list)

I hope it helps

Anthony Martinez
Anthony Martinez
13,111 Points

Thanks, but this isn't relevant to the actual issue I'm dealing with