0% found this document useful (0 votes)
9 views22 pages

100 Dayspy

The document outlines a coffee machine program that manages drink orders, including espresso, latte, and cappuccino, along with their ingredients and prices. It features functions for reporting resources, processing payments, and handling user requests. The main loop allows users to select drinks or check resources, while ensuring sufficient ingredients are available for each order.

Uploaded by

Hasta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views22 pages

100 Dayspy

The document outlines a coffee machine program that manages drink orders, including espresso, latte, and cappuccino, along with their ingredients and prices. It features functions for reporting resources, processing payments, and handling user requests. The main loop allows users to select drinks or check resources, while ensuring sufficient ingredients are available for each order.

Uploaded by

Hasta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

drinks = {

"espresso":{
"Water" : 100,
"Milk" : 0,
"Coffee" : 18,
"Money": 1.50
},
"latte" : {
"Water" : 200,
"Milk" : 24,
"Coffee" : 150,
"Money": 2.50
},

"cappuccino":{
"Water" : 250,
"Milk" : 24,
"Coffee" : 100,
"Money" : 3.00
},
"resources" :{
"Water": 2000,
"Milk": 700,
"Coffee": 350,
"Money":0
}
}

def report():
print(f"Water : {drinks["resources"]["Water"]}ml")
print(f"Milk : {drinks["resources"]["Milk"]}ml")
print(f"Coffee : {drinks["resources"]["Coffee"]}g")
print(f"Money : ${drinks["resources"]["Money"]}")
def count_money(item_price, item_name):
print(f"Please enter currency required for purchase : {item_price}")
pennies = float(0.01) * float(input("Insert amount of pennies: "))
nickels = float(0.05) * float(input("Insert amount of nickels: "))
dimes = float(0.10) * float(input("Insert amount of dimes: "))
quarters = float(0.25) * float(input("Insert amount of quarters: "))
total_money = pennies+nickels+dimes+quarters
change = round((total_money - item_price),2)
if total_money < item_price:
print("Sorry insufficient currency , you will be refunded and returned
to the menu now.")
mainloop()
else:
print(f"Here's your change {change}, Enjoy your
{item_name.title()}")

#Process user input


def drinks_request(drink):
if drink == "report":
report()
mainloop()
elif drink == "espresso" or drink == "latte" or drink == "cappuccino":
if drinks["resources"]["Water"] < drinks[drink]["Water"]:
print("Sorry, insufficient water for that order")
mainloop()
elif drinks["resources"]["Milk"] < drinks[drink]["Milk"]:
print("Sorry, insufficient milk for that order")
mainloop()
elif drinks["resources"]["Coffee"] < drinks[drink]["Coffee"]:
print("Sorry, insufficient coffee for that order")
mainloop()
else:
count_money(drinks[drink]["Money"],drink)
drinks["resources"]["Water"] -= drinks[drink]["Water"]
drinks["resources"]["Milk"] -= drinks[drink]["Milk"]
drinks["resources"]["Coffee"] -= drinks[drink]["Coffee"]
drinks["resources"]["Money"] += drinks[drink]["Money"]
mainloop()
else:
print("Sorry we don't have that yet. ")
mainloop()

def mainloop():
user_choice = input("What would you like? (Espresso/Latte/Cappuccino)
").lower()
if user_choice == "off":
print("Thank you for using our services. Come again!")
return 0
else:
drinks_request(user_choice)

mainloop()

You might also like