You work in the best consumer electronics corporation, and your boss wants to find out which three products generate the most revenue.
Given 3 lists of the same length like these:

* products: `["Computer", "Cell Phones", "Vacuum Cleaner"]`
* amounts: `[3, 24, 8]`
* prices: `[199, 299, 399]`


return the three product names with the highest revenue (`amount * price`).

**Note**: if multiple products have the same revenue, order them according to their original positions in the input list.

Difficulty: introductory

Starter code:

def top3(products, amounts, prices):
	

Solutions:
def top3(*args):
    return [item[0] for item in sorted(zip(*args), key=lambda x: x[1]*x[2], reverse=True)[:3]]

import heapq

def top3(products, amounts, prices):
    items = zip(products, amounts, prices)
    return [product for product, _, _ in heapq.nlargest(3, items, key=lambda item: item[1] * item[2])]

def top3(products, amounts, prices):
    comparison={}
    topList=[]
    for i in range(len(products)):
        comparison[products[i]] = amounts[i]*prices[i]
    [topList.append(k) for k, v in sorted(comparison.items(), key=lambda x: x[1],reverse=True)]
    return topList[:3]

top3 = lambda x,y,z: [d[0] for d in sorted(list(zip(x,y,z)), key=lambda w: -w[1]*w[2])[:3]]

import pandas as pd
def top3(products, amounts, prices):
    df = pd.DataFrame({
        'Product' : products,
        'Amount' : amounts,
        'Price' : prices})
    df['Revenue']=df['Amount']*df['Price']
    df.sort_values(by=['Revenue'], ascending=False,inplace=True)
    product_sort = df['Product'].values.tolist()
    return product_sort[0:3]

def top3(products, amounts, prices):
    result = {products[i]:amounts[i]*prices[i] for i in range(len(products))}
    result = list(sorted(result.items(), key = lambda x: x[1], reverse = True))
    return [i[0] for i in result[:3]]

def top3(products, amounts, prices):
    productObjects = []
    for p in range(0, len(products)):
        productObjects.append(Product(products[p], amounts[p], prices[p], p))
    top3Products = sorted(productObjects, key = lambda x: x.Revenue, reverse = True)[:3]
    if len(list(p.Revenue for p in top3Products)) != len(list(p.Revenue for p in top3Products)):
        return [x for _,x in zip(products, names)]
    return [p.Name for p in top3Products]
            
class Product():
    def __init__(self, name, amount, price, defaultIndex):
        self.Name = name
        self.Revenue = amount * price
        self.DefaultIndex = defaultIndex

def top3(products, amounts, prices):
    catalog = {n:amounts[i] * prices[i] for i,n in enumerate(products)}
    return sorted(catalog, key=catalog.get, reverse=True)[:3]

def top3(products, amounts, prices):
    info = {}
    
    for index in range(len(products)):
        info[products[index]] = amounts[index] * prices[index]
    
    return sorted(info, key = lambda n: info[n], reverse = True)[:3]


from operator import itemgetter

def top3(products, amounts, prices):
    zipped = zip(products, amounts, prices)
    revenues = list((product, amount * price) for product, amount, price in zipped)
    revenues.sort(key = itemgetter(1), reverse=True)
    return [product for product, revenue in revenues][:3]