#Create a solution that accepts a string input representing a
#grocery store item and an integer input identifying the number of items purchased on a recent visit.
#The following dictionary purchase lists available items as the key and the cost per item as the value.
#purchase = {"bananas": 1.85, "steak": 19.99, "cookies": 4.52, "celery": 2.81, "milk": 4.34}
#Additionally,
#If fewer than 10 items are purchased, the price is the full cost per item.
#If between 10 and 20 items (inclusive) are purchased, the purchase gets a 5% discount.
#If 21 or more items are purchased, the purchase gets a 10% discount.
#Output the chosen item and the total purchase cost to two decimal places.
#REMEMBER ITS WANTING MATH NOT OUTPUTS FOR DISCOUNTS
purchase = {"bananas": 1.85, "steak": 19.99, "cookies": 4.52, "celery": 2.81, "milk": 4.34}
print("Enter the item to purchase:")
item = input()
print("Enter the quantity of that item:")
quantity = int(input())
price = purchase[item] * quantity
#cost per item: <10 is full price, 10-20 (inclusive) is 5% discount, and 21+ is 10% discount
if quantity < 10:
pass
elif 10 <= quantity <= 20:
price *= 0.95
else:
price *= 0.90
print(f"{quantity} {item} total cost: ${price:.2f}")
To embed this project on your website, copy the following code and paste it into your website's HTML: