converting keys and values of the same length into dictionary form

Your function immediately overwrites the keys and values parameters with empty lists, so you always return an empty dictionary.

Just deleting the first two lines of the function should fix it. You could also shorten it down further to just:

def dict_build(keys,values):
    if len(keys) == len(values):
        return dict(zip(keys, values))
        return None

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top