# Title: cost calculator # Author: Jacob # Date: 2 november # Version: 1 # Purpose: This program will ask for a name and budget. # It will calculate the cost of food and display the remaining budget. # Collect input name = input("What is your name? ") print(f"Kia ora {name}") budget = float(input("How much is your budget to spend? $")) # Variables smoothie = 6.5 pie = 6 wedges = 4.5 # Ask what the customer wants food = input("What do you want to buy? A smoothie $6.5, pie $6 or wedges $4.5? ").lower() # Calculate total cost total = 0 if "smoothie" in food: total = total + smoothie if "pie" in food: total = total + pie if "wedges" in food: total = total + wedges # Check the order if total > 0: print(f"{name}, your total cost is ${total:.2f}") if budget >= total: new_budget = budget - total print(f"You have ${new_budget:.2f} remaining.") else: print("Sorry, you do not have enough money.") print(f"You need ${total - budget:.2f} more.") else: print("You have entered an invalid option.") # Display output print("The program has ended")