from acme import Product
import random


# Creating two lists to be combined into product names
adj = ['useful', 'cute', 'decent', 'strong', 'boring', 'federal',
       'pure', 'suitable', 'practical', 'sacred']

noun = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', 'Bowlingball', 'Elephant',
        'Crane', 'Computer', 'Train', 'Blanket']


def generate_products(n=30):
    '''Generate n random pruducts using product_list
    '''
    # Begin with enpty list
    products = []
    prod_names = []
    c = 0                   # starting a counter

    while c < (n+1):        # while loop until c goes up to n
        synth = random.choice(adj) + ' ' + random.choice(noun)
        prod_names.append(synth)
        c = c+1             # Adds to the counter

    for _ in list(range(n)):
        product = Product(name=random.sample(prod_names, k=1), # Instantiate
                          price=random.randint(5, 100),
                          weight=random.randint(5, 100),
                          flammability=random.uniform(0, 2.5))
        products.append(product)             # add particular products until n

    return products


def inventory_report(products):
    '''inspects values generated by the generate_products
    '''
    # Begining with empty lists
    names = []
    prices = []
    weights = []
    flames = []
    gs = products
    for g in gs:
        names.append(g.name)
        prices.append(g.price)
        weights.append(g.weight)
        flames.append(g.flammability)
    
    print('Number of Unique Products', len(names))
    print('Average Price: ', sum(prices) / len(prices))
    print('Average Weight: ', sum(weights) / len(weights))
    print('Average Flammability', sum(flames) / len(flames))


if __name__ == '__main__':
    inventory_report(generate_products())

from acme import Product
import random


# Creating two lists to be combined into product names
adj = ['useful', 'cute', 'decent', 'strong', 'boring', 'federal',
       'pure', 'suitable', 'practical', 'sacred']

noun = ['Anvil', 'Catapult', 'Disguise', 'Mousetrap', 'Bowlingball', 'Elephant',
        'Crane', 'Computer', 'Train', 'Blanket']


def generate_products(n=30):
    '''Generate n random pruducts using product_list
    '''
    # Begin with enpty list
    products = []
    prod_names = []
    c = 0                   # starting a counter

    while c < (n+1):        # while loop until c goes up to n
        synth = random.choice(adj) + ' ' + random.choice(noun)
        prod_names.append(synth)
        c = c+1             # Adds to the counter

    for _ in list(range(n)):
        product = Product(name=random.sample(prod_names, k=1), # Instantiate
                          price=random.randint(5, 100),
                          weight=random.randint(5, 100),
                          flammability=random.uniform(0, 2.5))
        products.append(product)             # add particular products until n

    return products


def inventory_report(products):
    '''inspects values generated by the generate_products
    '''
    # Begining with empty lists
    names = []
    prices = []
    weights = []
    flames = []
    gs = products
    for g in gs:
        names.append(g.name)
        prices.append(g.price)
        weights.append(g.weight)
        flames.append(g.flammability)
    
    print('Number of Unique Products', len(names))
    print('Average Price: ', sum(prices) / len(prices))
    print('Average Weight: ', sum(weights) / len(weights))
    print('Average Flammability', sum(flames) / len(flames))


if __name__ == '__main__':
    inventory_report(generate_products())

# Creating two lists to be combined into product names Generate n random pruducts using product_list # Begin with enpty list # starting a counter # while loop until c goes up to n # Adds to the counter # Instantiate # add particular products until n inspects values generated by the generate_products # Begining with empty lists