コード例 #1
0
def enter_food_quantity():
    global category_items
    global category_items_quantity
    
    '''
    #Taking input for quantity of Food Items
    #Splitting the category with respect to multiple items selected or single item
    '''
    
    quantity_req = input("Enter a  quantity required : ")
    category_items_quantity = quantity_req.split(',')
    
    #Checking values returned are digits
    for number in category_items_quantity :
        if Validate.validate_input_is_decimal(number) == False :
            enter_food_quantity()
        elif int(number) > 25 and int(number)  <= 0 :
            enter_food_quantity()
            
            
    print("Category name , Quantity")
    for category_index , quantity_item in zip(category_items , category_items_quantity) :
        
        print(category_index ," ", quantity_item)
        FoodModule.Food.cart_dict[category_index] = quantity_item
コード例 #2
0
def select_category_choice():
    global list_of_category
    global list_numbers
    
    choice=input("Please Select The Category with its Corresponding Number :")
    v_choice = Validate.validate_input_is_decimal(choice)
#     print(v_choice)
#     print("len(list_of_category)")
#     print(len(list_of_category))
    
    if v_choice == False:
        print("Please select from the given choices only.")
        select_category_choice()
    else :
        if int(choice) <= len(list_of_category) and int(choice) >= 1 :
            for index in zip(list_numbers,list_of_category) :
                    if int(choice) == index[0] :
                        print("Choice Selected : ", index[0],"-", index[1])
                        return index[1]
        else : 
            print("Please select from the given choices only.")
            select_category_choice()