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

Gary Gibson
Gary Gibson
5,011 Points

Passed Task 3 without changing a thing from Task 2...?

I didn't change a thing after I passed Task 2 and hit "Check Work" and got the same code to pass for Task 3. Why is this?

4 Answers

Here is all answers:

Task 1:

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

Task 2:

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

Task 3:

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

And it works, I've tried. :)

I think you used join like this:

.format(sundaes.join(', '))
Gavin Ralston
Gavin Ralston
28,770 Points

Perhaps you added the format() method and formatted the string already in step 2?

Step 2 only asks for you to create the string and store it in menu, step 3 asked for the format() method to be called.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Gary,

It may have just been a weird glitch you encountered. I just ran through the quiz and Task 3 would not pass until I entered in the correct code for that part. If I just clicked "check work", I got "Bummer! Did you use .join(", ")?"

:)

Gary Gibson
Gary Gibson
5,011 Points

Ah, I see. I did Task 3 as part of Task 2. I'm a little surprised the test didn't reprimand me for jumping ahead.