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

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)