In P(), if someone orders 6 pizzas, that person gets charged for 8 because the remainder of 6 // 3 is not 1; PP() has the same issue.
To tack onto perfringo's critique, the functions are poorly done. They should have parameters instead of input inside of them. If P() is code like this:
To tack onto perfringo's critique, the functions are poorly done. They should have parameters instead of input inside of them. If P() is code like this:
pizza_prices = { 0: 0.00, 1: 10.99, 2: 20.99, 3: 29.99 } def P(number, prices): price = prices.get(number, prices[len(prices) - 1]) quotient = number // 3 remainder = number % 3 pizza_sales = (quotient * price) + prices[remainder] return pizza_sales, number, remainder, quotient P(10, pizza_prices)then it fixes the problem from before and is easy to update. You can provide any dict in the format of pizza_prices and change all the pricing. Plus, you can use P() for the pasta as well instead of having two separate functions since they are identical. Now, it still performs too much. If a function returns more than one value, it likely does too much.