Untitled

 avatar
unknown
python
3 years ago
1.3 kB
5
Indexable

MENU = {"soda","fries","burguer","shake","cookie","chicken","sandwich"}

def get_order():
    current_order = []  
    while True:
        print("-----------------------Menu---------------")
    
        print("1.burguer 20K")
        print("2.sanwdich 15k")
        print("3.soda 5k")
        print("4.fries 7k")
        print("5.shake 8k")
        print("6.cookie 3k")
        print("7.chicken 12k")
            
        order = input("Insert the name of the product:  ")
        if order in MENU :
                quantity =int(input("Enter Quantity  "))
                
                current_order.append((order,quantity))
            
        else:
            print("Select something from menu")
            continue
        if is_order_complete():
           return current_order
        
def is_order_complete():
    answer = input("Anything else? yes/no :   ")
    if answer == "no":
        return True
    elif answer == "yes":
        return False
    else:
        raise Exception("invalid input")
        

def output_order(order_list):
    print("Okay, so you want")
    for order in order_list:
        print(order)


def main():
    order = get_order()
    output_order(order)
    print("Thanks for your order")
    
if __name__ == "__main__":
    main()
Editor is loading...