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 trialIsaac Barron
7,011 Points[SOLVED] -- What am I doing wrong here?
I understand how this format method works but its just not working for me. Not sure what I'm doing wrong
Isaac Barron
7,011 PointsChallenge Task 1 of 3
I think it's time for a snack. Luckily I have a string full of types of ice cream sundaes. Unluckily, they're all in one string and the string has semi-colons in it too. Use .split() to break the available string apart on the semi-colons (;). Assign this to a new variable sundaes.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
Challenge Task 2 of 3
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: {}.".
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = 'Our available flavors are: {}'
Challenge Task 3 of 3
Alright, let's finish making our menu. Combine the sundaes list into a new string, joining them with a comma and a space (", "). Use that string with a .format() on our existing menu variable and replace the current value of menu.
The error => Bummer! Didn't find the right series of sundaes and commas in menu
.
available = "banana split;hot fudge;cherry;malted;black and white"
sundaes = available.split(';')
menu = 'Our available flavors are: {}'.format(', '.join(sundaes))
James N
17,864 PointsThanks! These codeChallenges are WAYYY to specific.
8 Answers
Isaac Barron
7,011 PointsI just figured it out and I was missing a period inside of my menu string.
# Incorrect
menu = 'Our available flavors are: {}'.format(', '.join(sundaes))
# ^
# Correct
menu = 'Our available flavors are: {}.'.format(', '.join(sundaes))
# ^
Jonathan Hughes
2,040 PointsI did the exact same thing, I presumed the period was just there to show the end of the string in task 2 so I removed it when inserting the ".format'".
Ary de Oliveira
28,298 PointsChallenge Task 2 of 3
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: {}.".
menu = 'our available flavors are: {}'
Cristobal Ortiz-Ortiz
1,000 Pointsit works what they put as an answer here but the explanation on the step 3 is not easy to understand :P cheers
Ary de Oliveira
28,298 PointsChallenge Task 2 of 3
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: {}.".
menu = 'our available flavors are: {}'
Lester Rusike
13,206 Pointsavailable = "banana split;hot fudge;cherry;malted;black and white" sundaes = available.split(';') menu = 'Our available flavors are: {}'.format(', '.join(sundaes))
gavin redelinghuys
Python Web Development Techdegree Student 425 Pointshi all can you please tell me what i did wrong because it keeps saying "Bammer! did you use the join(',') here i my code menu = " Our available flavor are: {}." jointed_string = ","join(sundaes) menu = menu.format(','.join(sundaes)
please help
gavin redelinghuys
Python Web Development Techdegree Student 425 PointsSorry not
menu = menu.format(jointed_string)
pickles
Courses Plus Student 280 PointsI was stuck on this for a long time and then realised that is because of US spelling!
Yes, I should have paid attention to the request, but sometimes us non US people don't even think to write flavor instead of flavour !!
Might be worth allowing both US and non US English variations of free text so others don't sit there shaking their fists like I was, haha!
Lesson learned!
Wilson Usman
35,206 PointsWilson Usman
35,206 PointsIsaac Barron Can you post the format your are talking about?