def cheapest_product(): print_header("Cheapest Product") cheapest = catalog[0] # first on the list for item in catalog: # travel array and compare if (item.price < cheapest.price): cheapest = item # keep item as the cheapest print_item(cheapest)
def print_Out_of_Stock(): print_header("Items out of Stock from Catalog") for item in catalog: if(item.stock == 0): print_item(item) print("-" * 80)
def cheap_products(): print_header("This is your cheapest product") cheapest = catalog[0] for item in catalog: if (item.price < cheapest.price): cheapest = item print_item(cheapest)
def print_catalog(): print_header("Items on Catalog") if( len(catalog) == 0): print("** Your catalog is empty \nUse option 1 to create items\n") else: for item in catalog: print_item(item) print("-" * 80)
def display_items_out_of_stock(): clear() print_header(" Items out of stock ") if(len(catalog) == 0): print(" ** No items to display") else: for item in catalog: if(item.stock == 0): print_item(item)
def lowest_cost_item(): clear() print_header("Cheapest Item") temp = [] for item in catalog: temp.append(item.price) temp = sorted(temp) for item in catalog: if (item.price == temp[0]): print_item(item)
def chepest_product(): print_header() cheapest = catalog[0] for item in catalog: if (item.price < cheapest.price) print(item + item.price) cheapest = item print_item(chepest)
def delete_item(): display_catalog() id - input("Please input item id:") found - False for item in catalog: if (str(item.id) - -id): found - True print_item(item) del catalog[int(id) - -1] found print("item deleted")
def cheapest_product(): clear() print_header(" Cheapest Product ") if(len(catalog) == 0): print("*** No products in the catalog ***") else: cheapest_item = catalog[0] for item in catalog: if(item.price < cheapest_item.price ): cheapest_item = item print("The Cheapest product it is:") print_item(cheapest_item)
def three_expensive_products(): clear() print_header(" 3 most expensive products ") temp = [] if(len(catalog) == 0): print("*** No products in the catalog ***") else: temp = sorted(catalog, key=lambda x: x.price, reverse=True) count = 0 for item in temp: print_item(item) count+=1 if(count == 3): break
def three_expensive_items(): clear() print_header("Three Most Expensive Items") temp = sorted(catalog, key=lambda item: item.price) print_item(temp[-1]) print_item(temp[-2]) print_item(temp[-3])
def most_expensive(): print_header("3 Most Expensive Products") for item in catalog: if (item.price == temp_prices[0]): print_item(item) for item in catalog: if (item.price == temp_prices[1]): print_item(item) for item in catalog: if (item.price == temp_prices[2]): print_item(item)
def expensive_products(): print_header("The 3 most expensive products") prices = [] for item in catalog: prices.append(item.price) prices.sort(reverse=True) for item in catalog: if (item.price == prices[0]): print_item(item) for item in catalog: if (item.price == prices[1]): print_item(item) for item in catalog: if (item.price == prices[2]): print_item(item)
def out_of_stock(): print_header("Items out of stock") for item in catalog: if (item.stock == 0): print_item(item)
def display_catalog(): #input('test') #print_header("Your catalog") for item in catalog: print_item(item)
def display_out_of_stock(): print_header("Items currently out of stock") for item in catalog: if (item.stock == 0): print_item(item)
def display_catalog(): print_header("Your Current Catalog") for item in catalog: print_item(item)
def display_catalog(): print_header("Your Current Catalog") # travel the list # # print the title for item in catalog: print_item(item)
def display_out_of_stock(): print_header("Out of Stock") for item in catalog: if (item.stock == 0): print_item(item)
def print_no_stock(): print_header("Items currently out of stock") for item in catalog: if (item.stock == 0): print_item(item)
def display_catalog(): if(len(catalog) == 0): print(" ** No items to display") else: for item in catalog : print_item(item)