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

Jan Lundeen
Jan Lundeen
5,886 Points

Adding a new string variable to display menu items - used join - received message that it's no longer passing

Hi,

Now I'm working on challenge task 2 of 3 under the split and joins section. I used the following code to display the menu items and created a variable called menu(see below). When I clicked recheck work, I got the message that "Oops! It looks like task 1 is no longer passing". I'm not sure what I did wrong. Any ideas? Thanks!

Jan

Let's add a new string variable for displaying our menu items. Make a new variable named menu that's set to "Our available flavors are: {}.".

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

menu = "Our available flavors are:{}".format(";".join.available)

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

I have to agree, sometimes it is VERY hard to know what they want. Good luck with part three of this challenge, it catches a lot of people.

3 Answers

available = "banana split;hot fudge;cherry;malted;black and white"
# Use .split() to break the available string apart on the semi-colons (;)
# Assign this to a new variable sundaes
sundaes = available.split(";")
# Make a new variable named menu that's set to  "Our available flavors are: {}."
menu = "Our available flavors are: {}." # <-- this is all they are asking here.  You over shot a bit
Jan Lundeen
Jan Lundeen
5,886 Points

Thanks John! I didn't realize it was that simple. Sometimes, it's hard to know what they want.

Where in the course so far does it say anything about the # symbol?

Hi Chad. It looks like your right at the beginning of Python. The # symbol should come up soon. It's what we use in Python to add comments that won't be read as code.

Yeah.... I wrote this comment before I found out about that. Thanks.