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()

Yasuhiko Tokunaga
Yasuhiko Tokunaga
928 Points

I can't understand why this code cause error. please help

available = "banana split;hot fudge;cherry;malted;black and white" sundaes = available.split(";") menu = "Our available flavors are: {}." display_menu = menu.fomat(", ".join(sundaes))

banana.py
available = "banana split;hot fudge;cherry;malted;black and white"
AJ Salmon
AJ Salmon
5,675 Points

You need an r in format :)

2 Answers

jonlunsford
jonlunsford
15,472 Points

Yasuhiko:

I'm not sure what error you received, but it looks like you are missing the last couple steps.

Part 1 of 3: Split available and assign to sundaes - YOU DID THIS

Part 2 of 3: Create variable called menu and set it to the string - YOU DID THIS

Part 3 of 3: Combine sundaes into a new variable called display_menu

Step A of part 3. Create variable display_menu and rejoin each item in sundaes with a comma and space.

display_menu =  ', '.join(sundaes)

Step B of part 3: Reassign the menu variable to use existing and format() to replace the placeholder with display_menu string.

menu = menu.format(display_menu)
Yasuhiko Tokunaga
Yasuhiko Tokunaga
928 Points

I acknowledge your kindness. I'm not good at English. So I did not understand what Question intended to. Now I understand. Thanks for your help

jonlunsford
jonlunsford
15,472 Points

You are very welcome! Glad it helped.