0 out of 68 challenges solved

Create a dictionary from two lists

Question:
Write a function called create_dictionary that takes two lists, one containing keys and the other containing values, as input and returns a dictionary by combining the elements from both lists. Use zip to pair the elements and create the dictionary.

Example:
Input:
Keys: ["a", "b", "c"]
Values: [1, 2, 3]
Output: {"a": 1, "b": 2, "c": 3}

def create_dictionary(keys, values):
    """
    Creates a dictionary by combining elements from two lists.

    Args:
        keys (list): The list of keys.
        values (list): The list of values.

    Returns:
        dict: A dictionary created by pairing the elements from both lists.
    """
    # TODO: Implement the create_dictionary function
    pass
Related challenges