Made an epic showcase website and API!
This commit is contained in:
parent
9e21e4dbdd
commit
1907fad7c5
89 changed files with 36444 additions and 3 deletions
|
|
@ -1,34 +0,0 @@
|
|||
class MenuItem:
|
||||
"""Models each Menu Item."""
|
||||
def __init__(self, name, water, milk, coffee, cost):
|
||||
self.name = name
|
||||
self.cost = cost
|
||||
self.ingredients = {
|
||||
"water": water,
|
||||
"milk": milk,
|
||||
"coffee": coffee
|
||||
}
|
||||
|
||||
|
||||
class Menu:
|
||||
"""Models the Menu with drinks."""
|
||||
def __init__(self):
|
||||
self.menu = [
|
||||
MenuItem(name="latte", water=200, milk=150, coffee=24, cost=2.5),
|
||||
MenuItem(name="espresso", water=50, milk=0, coffee=18, cost=1.5),
|
||||
MenuItem(name="cappuccino", water=250, milk=50, coffee=24, cost=3),
|
||||
]
|
||||
|
||||
def get_items(self):
|
||||
"""Returns all the names of the available menu items"""
|
||||
options = ""
|
||||
for item in self.menu:
|
||||
options += f"{item.name}/"
|
||||
return options
|
||||
|
||||
def find_drink(self, order_name):
|
||||
"""Searches the menu for a particular drink by name. Returns that item if it exists, otherwise returns None"""
|
||||
for item in self.menu:
|
||||
if item.name == order_name:
|
||||
return item
|
||||
print("Sorry that item is not available.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue