Ad

Welcome to kaju bakery,

Kaju bakery deals with large number of orders of cake. So to handle the cake demand we need a function that takes in the number of servings of cake required and price of cake in dollar and returns the total price for that cake.
We also impose tax of 1$ so keep that in mind too

Have the function named deliver and return the total price customer has to pay in the counter.

also check if the number of servings <= 0 then just return zero.

Code
Diff
  • def price(servings, price):
        return servings * price + 1 if (servings > 0 and price > 0) else 0
    • def price(servings, price):
    • if servings >0:
    • cost = servings * price
    • cost += 1
    • return cost
    • else:
    • return 0
    • return servings * price + 1 if (servings > 0 and price > 0) else 0