question archive What will the python code be for the following output? Welcome to The Ice Creamery These are the 8 flavors we are serving today at The Ice Creamery: Flavor #: 1 Blueberry Crunch Flavor #: 2 Butter Pecan Flavor #: 3 Chocolate Flavor #: 4 Cookie Dough Flavor #: 5 Neapolitan Flavor #: 6 Strawberry Flavor #: 7 Vanilla Flavor #: 8 Very Berry Strawberry Please enter the cone size of your choosing: S, M, or L: S Please enter your flavor number: 5 Your total is: $1
Subject:Computer SciencePrice:4.86 Bought13
What will the python code be for the following output?
Welcome to The Ice Creamery
These are the 8 flavors we are serving today at The Ice Creamery:
Flavor #: 1 Blueberry Crunch
Flavor #: 2 Butter Pecan
Flavor #: 3 Chocolate
Flavor #: 4 Cookie Dough
Flavor #: 5 Neapolitan
Flavor #: 6 Strawberry
Flavor #: 7 Vanilla
Flavor #: 8 Very Berry Strawberry
Please enter the cone size of your choosing: S, M, or L: S
Please enter your flavor number: 5
Your total is: $1.50
Your smallish sized cone of The Ice Creamery's Neapolitan will arrive shortly.
Thank you for visiting the Ice Cream Creamery
#define price for small, medium and large cone SMALL_PRICE = 1.50 MEDIUM_PRICE =2.50 LARGE_PRICE = 3.00 #Welcome message to Ice Creamery and flavour menu display print("Welcome to The Ice Creamery") 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") #get the size of cone from user cone_size = input("Please enter the cone size of your choosing: S, M, or L:") #get the flavour number from user, convert to int flavour_number = int(input("Please enter your flavor number:")) #based on cone size find price and size if cone_size == 'S': price = SMALL_PRICE size = "smallish" elif cone_size == 'M': price = MEDIUM_PRICE size = "medium" elif cone_size == 'L': price = LARGE_PRICE size = "large" #based on flavour number find flavour name 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" #print total bill and order details print("\nYour total is: $", "{:.2f}".format(price)) print(f"Your {size} sized cone of The Ice Creamery's {flavour_name} will arrive shortly.") #print thanks message print("Thank you for visiting the Ice Cream Creamery")
Step-by-step explanation
1) Above program implements menu and billing system for The Ice Creamery
2) It display a welcome message and menu for icecream flavours
3) It get user option of size of cone and its flavour
4) It displays the price based on size and flavour to user
5) Finally it displays thank you message
6) Copy above program in python file and run
7) Below are some test outputs
Test Output:
Test 1
Welcome to The Ice Creamery
These are the 8 flavors we are serving today at The Ice Creamery:
Flavor #: 1 Blueberry Crunch
Flavor #: 2 Butter Pecan
Flavor #: 3 Chocolate
Flavor #: 4 Cookie Dough
Flavor #: 5 Neapolitan
Flavor #: 6 Strawberry
Flavor #: 7 Vanilla
Flavor #: 8 Very Berry Strawberry
Please enter the cone size of your choosing: S, M, or L:S
Please enter your flavor number:5
Your total is: $ 1.50
Your smallish sized cone of The Ice Creamery's Neapolitan will arrive shortly.
Thank you for visiting the Ice Cream Creamery
Test 2
Welcome to The Ice Creamery
These are the 8 flavors we are serving today at The Ice Creamery:
Flavor #: 1 Blueberry Crunch
Flavor #: 2 Butter Pecan
Flavor #: 3 Chocolate
Flavor #: 4 Cookie Dough
Flavor #: 5 Neapolitan
Flavor #: 6 Strawberry
Flavor #: 7 Vanilla
Flavor #: 8 Very Berry Strawberry
Please enter the cone size of your choosing: S, M, or L:L
Please enter your flavor number:8
Your total is: $ 3.00
Your large sized cone of The Ice Creamery's Very Berry Strawberry will arrive shortly.
Thank you for visiting the Ice Cream Creamery