Incorporate this code based on your needs. But you get the idea on how to do that. I made list of dicts using 3 lists you provided (productList, priceList, code_of_product) And everything else is just straight forward :)
productList = ["Salad Server Set", "Party Serviette Holder", "Tea Set", "Mixing Bowl Set", "Knife Block Set",
"Coffee Capsule Holder", "Plastic Sensor Soap Pump", "Storage Bucket", "Oven Glove", "Apron",
"Biscuit Barrel", "Chopping Board", "Carioca Cups", "Soup Bowls", "Elevate Wood Turner",
"Pasta Machine", "Teapot", "Cake Pop Scoop", "Cookbook Stand", "Chocolate Station", "Coffee Maker",
"Pepper Mill", "Salt Mill", "Glass Storage Jar", "Measuring jug", "Kitchen Scale", "Tenderiser",
"Pizza Docker", "Knife Sharpener", "Steel Cork Opener", "Steel Garlic Press", "Steel Can Opener",
"Stainless Steel Crank Flour Sifter", "Mineral Stone Mortar and Pestle", "Citrus Cather",
"Cherry & Olive Pitter", "Multi Grater-Detachable", "Stainless Steel Colander", "Steel Pizza Pan",
"Pop Container"]
priceList = [18.70, 11.95, 39.95, 49.95, 99.95, 29.95, 79.95, 24.95, 9.95, 29.95, 39.95, 12.95, 54.95,
43.00, 19.95, 144.95, 29.95, 9.95, 29.95, 34.95, 29.00, 84.94, 84.95, 4.95, 19.95, 39.95, 34.95,
19.95, 79.95, 36.95, 34.95, 36.95, 33.95, 74.95, 19.95, 27.95, 26.95, 44.95, 12.95, 22.95];
code_of_product = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,
38,39]
# Generate a list of dicts from 3 lists productList, priceList, code_of_product
products = [ {'product_name': productList[i], 'price': priceList[i], 'code': code_of_product[i] } for i in range(len(productList)) ]
def catalogue():
global productList, priceList, code_of_product
print('{:<12}\t{:<40}{:<20}'.format("code", "product", "Price $"))
print('{:<12}\t{:<40}{:<20}'.format("----", "------------------------------------", "-------"))
for prod in range(len(products)):
print('{:<12}\t{:<40}{:<20}'.format(products[prod]["code"], products[prod]["product_name"], products[prod]["price"]))
catalogue()
code = int(input("Please input code?"))
quantity = int(input("Please input quntity?"))
def showRecord(cd, qty):
price = products[cd]["price"]
total = float(price)*float(qty)
print(f"Product name: {products[cd]['product_name']}")
print(f"Price: ${price}")
print(f"Total: {total}")
showRecord(code, quantity)