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 (2015) Python Data Types Use .split() and .join()

Liran Dangoor
Liran Dangoor
1,340 Points

Help with error I get

I receive an error and cannot complete the task. It says it cant find all the items in the list for some reason.

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"

sundaes = available.split(";")

menu = "Our available flavors are: {},"

menu.format(", ".join(sundaes))

2 Answers

Torsten Lundahl
Torsten Lundahl
2,570 Points

When you format a string using the .format() method, you have to assign the new value to a variable. Otherwise the method result won't be saved.

menu = menu.format(", ".join(sundaes))

Also, keep in mind that the challenges often are very specific. If you misspell or change the given information it will cause an error.

Liran Dangoor
Liran Dangoor
1,340 Points

I see, thank you.

I didn't understand that I had to save it. Working by the examples shown in the previous video didn't indicate it.

Nonetheless, I appreciate your help.

Can you give Torsten Γ–sterlund a Best Answer? This might make it easier in the Community for people just to glance at this question and see it marked as answered.

Also, it would give the person who answered this question (Torsten Γ–sterlund) an additional 12 forum point for this topic (Python).

Thanks for understanding :smile:

William Li