Q:

How to pass multiple list values as function parameters?

Would someone be able to help me understanding how can I pass values from multiple lists as function parameters? I'm trying to update email for each of myemailId with url that includes customerId.
my code so far:
emailId = [732853380,7331635674]
customerId = ['cust-12345-mer','cust-6789-mer']

for x, y in zip(emailId, customerId):
    def update_email(emailId, token, user, notes="https://myurl.com/customer?customerId =" + customerId):
        headers = {     'accept': 'application/json',
                    'Content-Type': 'application/json',
                    'token': token,
                    'user': user}
        endpoint = 'email/'
        body = {'emailId': emailId, 'user': user, 'notes': notes}
        requests.put(url = host + endpoint, headers = headers, json=body)
        return True

but receiving this error that is corresponding to the line that starts with def update_email...: 
TypeError: must be str, not list

Thanks in advance! 

A:

First of all, you shouldn't define the function for each loop iteration but once before executing the loop.
In order to pass the values, use:
emailId = [732853380, 7331635674]
customerId = ['cust-12345-mer', 'cust-6789-mer']

def update_email(emailId, token, user, customerId):
    notes = "https://myurl.com/customer?customerId =" + customerId
    headers = {'accept': 'application/json',
               'Content-Type': 'application/json',
               'token': token,
               'user': user}
    endpoint = 'email/'
    body = {'emailId': emailId, 'user': user, 'notes': notes}
    requests.put(url=host + endpoint, headers=headers, json=body)
    return True

for x, y in zip(emailId, customerId):
    update_email(x, token, user, y)

