ModdersCentral

Full Version: Python Product Finder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
#productid,productname,product price
products = [
"1262", "Coco Pops", 4.00, 
"8743", "Sugar Puffs", 3.60, 
"9512", "Rice Krispies", 3.90
]
product_found = -1

product_code=input("Enter the product code that you want to find: ")

for i in range(0,len(products),3):
    if products[i] == product_code:
           product_found =  i
if product_found != -1:
    print(products[product_found + 1])
    print(products[product_found + 2])
else:
    print("not found")
www.000webhost.com