Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Display a welcome message on the screen: Welcome to The Ice Creamery Reference: Learn to Program With Python 3 : A Step - by -
Display a welcome message on the screen:
Welcome to The Ice Creamery
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Print Statements.
Create a new list variable for storing seven ice cream flavors ie flavorsList
flavorsList Vanilla "Chocolate", "Strawberry", "Pistachio", "Butter Pecan", "Cookie Dough", "Neapolitan"
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Lists.
Change the name of one flavor in the list of flavors just created.
Hint: Use the index value for the position of the flavor in the list and assign it a new value.
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd Edition, Chapter : Lists Changing a Value in a List.
Use a builtin list operation to append a new flavor to the end of the list. You should now have eight flavors in the list.
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Lists Table : The BuiltIn List Operations.
Use a builtin list operation to sort the flavors list in alphabetical order.
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Lists Table : The BuiltIn List Operations.
Store the number of flavors in the list in a variable and display the number of flavors.
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Lists Determining the Number of Elements in a List: The len Function.
Loop through each flavor in the list using a FOR loop to display the number and name for each item in the list.
Create FOR loop to process each flavor in flavorsList list.
With each iteration, display the flavor # using the index value in the flavors list and the name of the flavor.
Hint: Remember index positions in lists start with zero. To make this more customer friendly, add one to the index value before displaying it
Reference: Refer back to your Unit readings in Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Simple Math; Chapter : Lists Position of an Element in a List: Index Accessing an Element in a List for Statements and for Loops.
Define dictionaries to hold the prices and descriptions for each cone size.
conePricesS:$M:$L:$
coneSizesS:"smallish","M:"more for meL:"lotta lickin"
Reference: Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Data Structures, Dictionary.
Prompt the user to enter a cone size S M or L Store their choice in a variable ie customerSize
OPTIONAL VALIDATION: Use an IF statement to ensure a valid value was entered. Display an error message if an invalid value was entered.
Reference: Refer back to your Unit and readings in Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : BuiltIn Functions Getting Input from the User; Chapter : The if Statement Comparison Operators.
Prompt the user to enter a flavor number. Store their choice in a number variable ie customerFlavor
Hint: Placing int ahead of the input statement will store the user input as a number. You will be using this number as the index to find the flavor value from the list.
OPTIONAL VALIDATION: Use an IF statement to ensure a valid value was entered. Display an error message if an invalid value was entered.
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.
Hint: Remember that index positions in lists start with zero. To make this more customer friendly, we added one to the index value before displaying it You will need to do the same here to display the appropriate value from the list.
Use print to print blank lines as necessary for readability.
Reference: Refer to Learn to Program With Python : A StepbyStep Guide to Programming, nd edition, Chapter : Lists Position of an Element in a List: Index Accessing an Element in a List; Chapter : Data Structures, Dictionary.
EXAMPLE PROGRAM OUTPUT
Welcome to The Ice Creamery
These are the flavors we are serving today at The Ice Creamery:
Flavor #: Blueberry Crunch
Flavor #: Butter Pecan
Flavor #: Chocolate
Flavor #: Cookie Dough
Flavor #: Neapolitan
Flavor #: Strawberry
Flavor #: Vanilla
Flavor #: Very Berry Strawberry
Please enter the cone size of your choosing: S M or L: S
Please enter your flavor number:
Your total is: $
Your smallish sized cone of The Ice Creamery's Neapolitan will arrive shortly.
Thank you for visiting the Ice Cream Creamery
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started