question archive I am trying to loop each flavor in my list using a loop to display the number and name for each item in the list

I am trying to loop each flavor in my list using a loop to display the number and name for each item in the list

Subject:Computer SciencePrice: Bought3

  1. I am trying to loop each flavor in my list using a loop to display the number and name for each item in the list. I need to know what the code is
  2. I also need to have my code in python allow currency symbols and need to know the code to allow currency symbols.
  3. I also need to change the last ice cream flavor to be Mint Chocolate Chip. It has to be changed through code, not just by retyping a different flavor.

 

My existing code looks like:

 

#Display a welcome message on the screen

print("Welcome to The Ice Creamery")

 

#new list variable for storing seven ice cream flavors

print("These are the 8 flavors we are serving today at The Ice Creamery:")

print("Flavor #: 1 Blueberry Crunch")

print("Flavor #: 2 Butter Pecan")

print("Flavor #: 3 Chocolate")

print("Flavor #: 4 Cookie Dough")

print("Flavor #: 5 Neapolitan")

print("Flavor #: 6 Strawberry")

print("Flavor #: 7 Vanilla")

print("Flavor #: 8 Very Berry Strawberry")

 

#Change the name of one flavor in the list of flavors

 

#Use a built-in list operation to append a new flavor to the end of the list

 

#Use a built-in list operation to sort the flavors list in alphabetical order

print(sorted_list)

print['B', 'aa', 'ab', 'b']

 

#Store the number of flavors in the list in a variable and display the number of flavors

if flavour_number == 1:

  flavour_name = "Blueberry Crunch"

elif flavour_number == 2:

  flavour_name = "Butter Pecan"

elif flavour_number == 3:

  flavour_name = "Chocolate"

elif flavour_number == 4:

  flavour_name = "Butter Pecan"

elif flavour_number == 5:

  flavour_name = "Neapolitan"

elif flavour_number == 6:

  flavour_name = "Strawberry"

elif flavour_number == 7:

  flavour_name = "Vanilla"

elif flavour_number == 8:

  flavour_name = "Very Berry Strawberry"

 

#Loop through each flavor in the list using a FOR loop to display the number and name for each item in the list

  #Use FOR loope to process each flavor in the flavorsList list

  #With each iteration display the flavor # using the index value in the flavors list and the name of the flavor.

 

#Define dictionaries to hold the prices and descriptions for each cone size

cash = 1.50 or 2.50 or 3.00

'${: .2f}' .format(cash)

'$1.50 or $2.50 or $3.00'

cash = 1.50 or 2.50 or 3.00

values = [1.50, 2.50, 3.00] 

template = 'SMALL_PRICE ${: .2f}.'

template = 'MEDIUM_PRICE ${: .2f}.'

template = 'LARGE_PRICE ${: .2f}:'

for value in values:

  print(template.format(value))

 

#Prompt the user to enter a cone size from small to large. Store their choice in a variable

cone_size = input("Please enter the cone size of your choosing: S, M, or L:")

if cone_size == S:

 print("your cone size is small")

elif cone_size == 's' or cone_size == 'S':

 print("cone size is small")

if cone_size == M:

 print("your cone size is medium")

elif cone_size == 'm or M':

 print("your conse size is medium")

if cone_size == L:

 print("your cone size is large")

elif cone_size == 'l' or cone_size == 'L':

 if cone_size == 'xl' or cone_size == 'XL' or cone_size == 'small, medium, large, extra large or Small, Medium, Large, Extra Large':...

 print("You have entered an invalid character or name. Please enter an S, M, or L")

 

#Prompt the user to enter a flavor number. Store their choice in a number variable.

flavour_number = int(input("Please enter your flavor number:"))

 

#Display the price, size description, and flavor for their choice. Use your conePrices dictionary to match the size value entered to the price. Use your coneSizes dictionary to match the size to the description of the size.

print("nYour total is: $", "{:.2f}".format(price))

print(f"Your {size} sized cone of The Ice Creamery's {flavour_name} will arrive shortly.")

 

#Thank the customer for visiting

print("Thank you for visiting the Ice Cream Creamery")

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE