Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

# Define energy drinks options

drinks_options = ["Coca Cola", "Sting", "Pepsi"]

# Get the number of products


num_products = int(input("Enter the number of products: "))

# Loop for each product


for product in range(num_products):
print(f"\nProduct {product + 1}")

# Select energy drink


print("\nPlease select an energy drinks option:")
for i, drink in enumerate(drinks_options):
print(f"{i+1}. {drink}")
selection = int(input("Enter your choice (1, 2, or 3): "))

# Input stock, unit price, and number of drinks sold


date = str(input("Enter Date: "))
stock = int(input("Enter the stock of drinks: "))
unit_price = float(input("Enter the unit price of drinks: "))
sold = int(input("Enter the number of drinks sold: "))
stock_remain = stock - sold

# Calculate total price before discount


total_price = unit_price * sold

# Apply discount
if sold >= 100:
total_price = unit_price * sold - 50
discount = 50 # $50 discount
else:
total_price = unit_price * sold
discount = 0 # $0 discount

print("\n\tInvoice")
print("------------------------")
print("Today:", date)
print("Energy Drink Name:", drinks_options[selection - 1])
print("Stock:", stock)
print("Unit Price: $", unit_price)
print("Number of Drinks Sold:", sold)
print("Total Price: $%.2f" % total_price)
print("Discount: $", discount)
print("Stock Remain:", stock_remain)
print('= ' * 55)
print("{:<18}{:<10}{:<15}{:<16}{:<15}{:<18}{:<15}".format('Date', 'Stock',
'UnitPrice', 'Sold', 'Total', 'Discount', 'Stock(Remain)'))
print("{:<18}{:<10}${:<15}{:<16}${:<15}${:<18}{:<15}".format(date, stock, unit_price,
sold, total_price, discount, stock_remain))
print('= ' * 55)

You might also like