# Noemi Cabrera # 1 October 2021 # In this project, I created a program regarding Cheese orders. It asks for the amount of pounds of cheese the # user wants to order. Then, if the value is valid, the price of the pounds entered will be calculated. # There is a minimum and maximum value. If the pounds are less than the minimum, an statement explaining that # will display. If the pounds are more than the maximum, an statement explaining that will display. # The difficulties I had were figuring out how to calculate the cost of the pounds ordered. To do this, I # multiplied the pounds by the price of each pound. The answer of the calculation is a float.
# [ This program asks for input on the amount of pounds of cheese the user wants to order. # If the user enters a value less than the minumum, an statement explaining that will display. # If the value is more than the maximum, an statement explaining that will display. # But, if the value is within the limits, the calculated cost of the pounds entered will display.] # create, call and test Cheese Order min_order_weight = 1 max_order_weight = 15 price = 4 print("Cheese Order") def cheese_order(): order_amount = float(input("Enter pounds of cheese you want to order (numeric value): " )) if order_amount < min_order_weight: return(order_amount, "is below the minimum order amount") elif order_amount > max_order_weight: return(order_amount, "is more than currently available stock") else: calc = order_amount * price cost = str(order_amount)+" pounds cost $"+ str(calc) return cost print(cheese_order())
Cheese Order 5.6 pounds cost $22.4