How to create a new list from other two lists, apply a function and append the output to each list?
<p>thank you in advance for the help.</p>

<p>I need to retrieve some data (clients and products) from a WebService. This code gets the data and transforms it into lists with dictionaries within them.</p>

<pre><code>    consumidores = requests.get(url + 'all_consumers', headers=custom_header)  # lista
    con = consumidores.json()
    productos = requests.get(url + 'all_products', headers=custom_header)  # lista
    prod = productos.json()

    c = []

    for key in con:
        c = [key['genero'], key['complexion'], key['tallaCamisa'], key['tallaPantalon'], key['edad'], key['ubicacion'],
         key['valorComercial'], key['valorCompra']]

    p = []
    for index in prod:
        p = [index['genero'], index['precio']]
</code></pre>

<p>Whats I need to do is to create two lists, one for costumers and one for products. Choose some specific elements for each costumer and product and create a new list that have to look like this</p>

<pre><code>new_list = [[costumer_1, costumer_element1, costumer_element2 , ... , product_1, product_element1, product_element2, ...], [costumer_1, costumer_element1, ..., product_1, product_element1, ...], [costumer_2, costumer_elementn, ... product_1, product_element1 ,...] , ...]
</code></pre>

<p>Then apply a function that will relate costumers with products and append the result to the list that produced that output:</p>

<pre><code>results = [[costumer_1, costumer_element1, costumer_element2 , ... , product_1, product_element1, product_element2, RESULT], etc]

    for key in con:
    index=0
    param_relcp = c[index][key['genero'],key['edad']]
    index=index + 1
</code></pre>

<p>This returns an error: IndexError: list index out of range and using this</p>

<pre><code>c = []
for key in con:
    c = [key['genero'], key['complexion'], key['tallaCamisa'], key['tallaPantalon'], key['edad'], key['ubicacion'],
         key['valorComercial'], key['valorCompra'], key['id']]
</code></pre>

<p>Only takes the elements only from the first one of the list of lists. Any help will be appreciated.</p>