Skip to content

Instantly share code, notes, and snippets.

@delululala
Last active December 9, 2025 17:44
Show Gist options
  • Select an option

  • Save delululala/83f5547663064797454f732e3cdcbae2 to your computer and use it in GitHub Desktop.

Select an option

Save delululala/83f5547663064797454f732e3cdcbae2 to your computer and use it in GitHub Desktop.
menu_display.pythonyeeeee
sales = []
#Price List Coffe
menu_prices = {
'Americano':18000,
'Latte':25000,
'Espresso':18000,
'Cappuccino':25000,
'Matcha':27000,
'Butterscoth Latte':27000,
'Mango Juice':20000,
}
#Quantity per Menu
menu_cost = {
'Americano':12600,
'Latte':18500,
'Espresso':12600,
'Cappuccino':18500,
'Matcha':20000,
'Butterscoth Latte':20000,
'Mango Juice':14000,
}
print('Avaible Menu: ', 'Americano, ', 'Latte, ', 'Espresso, ', 'Cappuccino, ', 'Matcha,', 'Butterscoth Latte, ', 'and Mango Juice.')
print('=================================================')
s_list = []
def add_to_sales(item,quantity=1):
item = item.title()
if item in menu_prices:
sales.append((item,quantity))
print(f'{quantity} of {item} were sold.')
else:
print(f'{item} does not exist in the menu.')
def calculate_total(flag=True):
total=0
for item,quantity in sales:
if flag:
total+= menu_prices[item] * quantity #sale
else:
total+=menu_cost[item] * quantity
return total
def display_sales():
if not sales:
print('NO sales today. ')
return
else:
print("\nToday's sales Sales Summary: ")
print("==================================================")
for item,quantity in sales:
print(f'{quantity} x {item} = {menu_prices[item] * quantity} Rupiah')
total_sales=calculate_total()
total_materials=calculate_total(False)
profit = total_sales-total_materials
print('================================================')
print(f'Total Sales Income : {total_sales:,} Rupiah')
print(f'Total Materials Cost : {total_materials:,} Rupiah')
print(f'Total Profit : {profit:,} Rupiah')
print('================================================')
#Main Program
end = True
print("Let's summarize today's sales")
while end:
sales_menu =input('Enter the menu that sold today: ').title()
sales_count = int(input('Enter the quantity sold: '))
add_to_sales(sales_menu, sales_count)
if input("Do you want to end this program? (please enter Y/N) ").upper() == 'Y':
end = False
display_sales()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment