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

I'm not sure why my codes is wrong. I tested this in my console Python editor and it seems to work.

In line four I created a variable "ice_cream" assigned random values to it. I then created the "menu" variable, called it on itself but passed the format method with a join statement. The error I receive is "Bummer! Did you use .join(",") Best I can think is my code is written inefficiently?

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

3 Answers

The problem wants you to display the available sundaes from the sundaes list, so you just need to alter it and take out the other list.

on older python you need to number your fields for the string format IE use {0} not {}

so likely you have a version mismatch of where you tested vs the online version

I think Justin answered the question. Misread the instructions and thought I had to create a third variable with a list. As it turns out I just had to pass sundaes into the .format type. Thanks for the help Alex and Justin.