withfunctions

.py

School

University of Florida *

*We aren’t endorsed by this school

Course

2800

Subject

English

Date

Jun 13, 2024

Type

py

Pages

4

Uploaded by ChiefOpossum3796

# Kayla Stanley, Spring 2022 # ka534381 # This program uses functions to automated a system that tells how many of what cupcakes they need. # I used the given assignment 4 solution to help me complete this assignment! # Setting up variables end = 0 loop = "valid" nests = 0 vanilla = 0 chocolate = 0 red_velvet = 0 coconut = 0 buttercream = 0 whipped = 0 fudge = 0 recipie_vanilla = 0 recipie_chocolate = 0 recipie_red_velvet = 0 recipie_coconut = 0 recipie_buttercream = 0 recipie_whipped = 0 recipie_fudge = 0 # Sets up the function for cupcake types def cupcake_menu(): print("What kind of cupcake is the customer wanting?") print("1. Vanilla") print("2. Chocolate") print("3. Red Velvet") print("4. Coconut") print("Enter the number for the variety they want:") # Sets up the function for frosting type def frosting_menu(): print("What type of frosting would they like?") print("1. Buttercream") print("2. Whipped") print("3. Fudge") print("Enter the number for the variety they want:") # Sets up the function to calculate total recipies needed from nests def recipie_batches(vanilla, chocolate, red_velvet, coconut, buttercream, whipped, fudge): recipie_vanilla = (int(vanilla) // 8) if int(vanilla) % 8 != 0: recipie_vanilla += 1 recipie_chocolate = (int(chocolate) // 8) if int(chocolate) % 8 != 0: recipie_chocolate += 1 recipie_red_velvet = (int(red_velvet) // 8) if int(red_velvet) % 8 != 0: recipie_red_velvet += 1
recipie_coconut = (int(coconut) // 8) if int(coconut) % 8 != 0: recipie_coconut += 1 recipie_buttercream = (int(buttercream) // 8) if int(buttercream) % 8 != 0: recipie_buttercream += 1 recipie_whipped = (int(whipped) // 8) if int(whipped) % 8 != 0: recipie_whipped += 1 recipie_fudge = (int(fudge) // 8) if int(fudge) % 8 != 0: recipie_fudge += 1 print("--------------------------\n" "| Recipie Amounts Needed |\n" "--------------------------\n" "") print("Cupcake Recipie Needs\n" "---------------------") print("Vanilla: \t", recipie_vanilla) print("Chocolate: \t", recipie_chocolate) print("Red Velvet: \t", recipie_red_velvet) print("Coconut: \t", recipie_coconut) print() print("Frosting Recipie Needs\n" "---------------------") print("Buttercream: \t", recipie_buttercream) print("Whipped: \t", recipie_whipped) print("Fudge: \t\t", recipie_fudge) return(recipie_vanilla, recipie_chocolate, recipie_red_velvet, recipie_coconut, recipie_buttercream, recipie_whipped, recipie_fudge) # Repeats main loop through survey and prompts for user to try again if given an invalid response while end != "finish": order_prompt = input("Do you have orders to process? \n" "(Type 'y' to continue or 'finish' to exit) ") print() # Adds the total cupcake and frosting nests given user input if order_prompt == "y": while loop == "valid": cupcake_menu() opt = input() if opt == "1" or opt == "2" or opt == "3" or opt == "4": # Vanilla if opt == "1": nests = int(input("How many vanilla nests do they want? ")) print() loop == 0 vanilla += nests while loop == "valid": frosting_menu()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help