Question

In: Computer Science

At Brenda’s Bakery, cantaloupes are sold as follows: 1-20 cantaloupes are $.75 each 21-50 cantaloupes are...

  1. At Brenda’s Bakery, cantaloupes are sold as follows:
  • 1-20 cantaloupes are $.75 each
  • 21-50 cantaloupes are $.70 each
  • 51-100 cantaloupes are $.65 each
  • 101 or more cantaloupes are $.60 each

For example:

  • If you buy 30 cantaloupes, you will pay $21.00 (30 cantaloupes at $.70 each).
  • If you buy 6 cantaloupes, you will pay $4.50 (6 cantaloupes at $.75 each).
  • If you buy 200 cantaloupes, you will pay $120.00 (20 cantaloupes at $.60 each).
  • If you buy 60 cantaloupes (see below), you will pay $39.00 (60 cantaloupes at $.65 each)

Please write a program where you input a number of cantaloupes and Python tells you the total cost.

Solutions

Expert Solution

It is request to please don't leave without thumbs up I really need it so that I can provide quality answer to you hoping for good thank you!

I have answer this question according to the question in my language and provided the code below and adding comment so that you can understand well , hope you like and please don't dislike

If You have Any Query Regarding this please ask in comment section I will be there to solve all your query in comment section immediately hope you will like it

#please do thumbs up i really need it thankyou!
# enter the cantaloupes which you want
amt = int(input("Enter the cantaloupes you want : "))

# checking conditions and calculating cost
if(amt>0):
    if amt<=20:
       cost = amt*0.75
    elif amt<=50:
        cost=amt*0.70
    elif amt<=100:
        cost=0.65 * amt
    else:
         cost=0.60 * amt

    print("Total cost is  : $",cost)
    
else:
    print("Invalid Number")

Output:


Related Solutions

21. If a 2.50 mol sample of water is heated from -50 °C to 75 °C...
21. If a 2.50 mol sample of water is heated from -50 °C to 75 °C at a constant pressure of 1 atm, what is the change in enthalpy?
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25?...
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25? = 200 25a − 15? − 5? = 300 10? + 20? − 30? + 100? = 400 how to do flowchart using gauss elimination and lu decomposition method
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25?...
10? + 50? + 20? + 10? = 100 5? + 15? + 75? − 25? = 200 25a − 15? − 5? = 300 10? + 20? − 30? + 100? = 400 how to write coding in matlab using lu decomposition
17, 18, 18, 18, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22,...
17, 18, 18, 18, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 23,23, 24,24,24,24,24,24,24,24,25,26,26,26,26,26,26,27,27,27,27,27,28,28,29,31,31,32,32,34,35,38 use the data to do the following: 1. sample mean 2. median 3. mode 4. standard deviation
On January 1, you sold short 100 shares of XYZ stock at $20 using a 50%...
On January 1, you sold short 100 shares of XYZ stock at $20 using a 50% initial margin. The interest rate on the margin account is 10% annually. On April 1 (in three-months), you covered the short sales by buying stock at a price of $15 per share. You paid 50 cents per share in commissions for each transaction. Assume you received interest on all your assets, i.e. the sum of the short sale proceeds and the margin. 1. What...
On January 1, you sold short 100 shares of XYZ stock at $20 using a 50%...
On January 1, you sold short 100 shares of XYZ stock at $20 using a 50% initial margin. The interest rate on the margin account is 10% annually. On April 1 (in three-months), you covered the short sales by buying stock at a price of $15 per share. You paid 50 cents per share in commissions for each transaction. Assume you received interest on all your assets, i.e. the sum of the short sale proceeds and the margin. 1. What...
On January 1, you sold short 100 shares of XYZ stock at $20 using a 50%...
On January 1, you sold short 100 shares of XYZ stock at $20 using a 50% initial margin. The interest rate on the margin account is 10% annually. On April 1 (in three-months), you covered the short sales by buying stock at a price of $15 per share. You paid 50 cents per share in commissions for each transaction. Assume you received interest on all your assets, i.e. the sum of the short sale proceeds and the margin. 1. What...
investment poor average good A 50 75 20 B 80 15 40 C -100 300 50...
investment poor average good A 50 75 20 B 80 15 40 C -100 300 50 Maximax, Maximin, Minimax Regreat, Hurxicz 0.4, Equal liklihood
Question 1 For the dataset: 20, 20, 10, 10, 40, 50, 20, 30, 10, 20, 50,...
Question 1 For the dataset: 20, 20, 10, 10, 40, 50, 20, 30, 10, 20, 50, 60, 20, 30, 50, 20, 30, 40, 30, 30, 30, 50, 40 calculate the max, min, mode, median and mean.(20%) Draw a boxplot with inner and outer fence For the data in part (i), if the value 60 was replaced by 2000, what would you call this value in the dataset? What could be the explanation for such a value? How can you through...
Orion, Inc. sold 17,000 units last year for $50 each. Variable costs per unit were $20...
Orion, Inc. sold 17,000 units last year for $50 each. Variable costs per unit were $20 for direct materials, $15 for direct labor, and $10 for variable overhead. Fixed costs were $10,000 in manufacturing overhead and $50,000 in nonmanufacturing costs. a. What is the total contribution margin? b. What is the unit contribution margin? c. What is the contribution margin ratio? d. If sales increase by 5,000 units, by how much will profits increase?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT