Question: Define a function that takes two parameters: cups _ sold ( representing the number of cups sold ) and price _ per _ cup (
Define a function that takes two parameters: cupssold representing the number of cups sold and
pricepercup representing the price per cup Inside the function, calculate the total revenue by multiplying the
number of cups sold by the price per cup and return the result.
Create a dictionary named coffeemenu where keys represent the names of coffee beverages eg "Espresso",
"Latte", "Cappuccino" and values represent the prices per cup for each beverage. You can determine the prices
for each beverage according to your preferences or assumptions.
Define another function that takes a dictionary salesdata as input. Inside this function, iterate through the
salesdata dictionary. For each coffee beverage in the dictionary, use the calculaterevenue function to calculate
the revenue generated by that beverage, and sum up the results to obtain the total revenue generated from all
coffee sales. Finally, return the total revenue.
To test the program, create a sample salesdata dictionary with the number of cups sold for each coffee type.
Afterward, call the function defined above for calculating revenue for the total coffee with this salesdata
dictionary as input and print the total revenue generated. This will ensure the correctness of the
implementation. Adjust the values in the salesdata dictionary according to your requirements for testing. For
example, the output might resemble:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
