Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Python Data Types Use .split() and .join()

python I feel I m close but there is an error 'Did you use "," .join()'

I do 4 step correct but i think there is some bug in line 4 so pls help me to find out

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

2 Answers

Hi there,

There are three things to change.

First, just leave in the first three lines of code - delete the others:

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

Second, you want to join on a comma and a space - you've missed the space out. And, lastly, pass sundaes into the join method, not available.

You end up with:

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

Steve.

nakalkucing
nakalkucing
12,964 Points

Thanks for answering. I worded my answer poorly. :)

I think you did fine - I just spotted your answer wasn't quite providing the full solution. We're all just trying to help so keep it up! :+1: :smile:

nakalkucing
nakalkucing
12,964 Points

Remove these lines:

display_menu=sundaes
"," .join(display_menu)
menu='Our available flavors are:{}'.format(','.join(display_menu))

and put parenthesis around 'Our available flavors are:{}'.format(','.join(available)) on the menu line. Now menu is equal to what display_menu is supposed to be. Hope this helps, Nakal

nakalkucing
nakalkucing
12,964 Points

And on the 'menu' line you have ', '.join(available) It should be ','.join(sundaes)