Lynn J.

asked • 09/27/22

Python Order Cost Calculator

1. Write a function called coffee_calculator with the input and outputs that are specified below


2. The function must Include one loop or iterator


3. The function must Include one conditional statement


4. The function must include one list or dictionary to store data


5. The function must include the following parameters: coffee_base, add_ins, rewards_discount


6. The order can only have one coffee milk base, with respective prices listed below


7. The order has between none and multiple add ins, with respective prices listed below


8. If a customer is part of the rewards program, subtract $1.00 from the total order


9. The coffee_base parameter must be a string


10. The add_ins parameter must be a list of strings where each string represents the optional add ins in the order (none to multiple)


11. The rewards_discount is a Boolean that represents if the order was made by a customer in the rewards program


12. The function must print a dollar amount with two decimal places


coffee_base = dairy, almond, oy, coconut

dairy: 4.35

almond: 4.60

soy: 5.85

coconut: 5.47


add_ins = cinnamon, vanilla, chocolate, sprinkles, hazelnut

cinnamon: $0.50

vanilla: $0.75

chocolate: $0.65

sprinkles: $1.00

hazelnut: $0.35



Coffee Input 1: (arguments of the function)

coffee_base: "dairy"

add_ins: "cinnamon", "chocolate", "sprinkles"

rewards_discount: False

Output: $6.50


Coffee Input 2: (arguments of the function)

coffee_base: "soy"

add_ins: []

rewards_discount: False

Output: $5.85


Coffee Input 3: (arguments of the function)

coffee_base: "almond"

add_ins: ["hazelnut"]

rewards_discount: True

Output: $3.95





1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.