Question

Python Jupyter Notebook Write a python function called profit that takes the number of meals (n)...

Python Jupyter Notebook

Write a python function called profit that takes the number of meals (n) sold by a restaurant in a month and calculates the monthly profit given the following information: The selling price of each meal is 12 USD (same for all meals) There is a fixed cost of 2500 USD per month regardless of the number of meals sold. There is a variable cost of 6 USD per each meal sold profit= total revenue- total cost = 12n - (2500 + 6n)

Now write a program that takes the number of meals sold in a given month from user and shows the monthly profit by calling the profit function.
Example:
How many meals did you sell last month?:1400
Your profit last month were 5900 USD

Homework Answers

Answer #1

Python code:

#defining profit function
def profit(n):
    #returning the profit
    return 12*n-(2500+6*n)
#accepting number of meals sold
n=int(input("How many meals did you sell last month?:"))
#calling profit function and printing the profit obtained
print("Your profit last month were "+str(profit(n))+" USD")

Screenshot:


Input and Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT