0 out of 68 challenges solved

Filter a dictionary to include only the key-value pairs where the value is an even number

Question:
Write a function called filter_even_values that takes a dictionary as input and returns a new dictionary containing only the key-value pairs where the value is an even number. Use dictionary comprehension to create the new dictionary.

Example:
Input: {"a": 2, "b": 3, "c": 4, "d": 5}
Output: {"a": 2, "c": 4}

def filter_even_values(dictionary):
    """
    Filters a dictionary to include only the key-value pairs where the value is an even number.

    Args:
    dictionary (dict): The input dictionary.

    Returns:
    dict: A new dictionary with the filtered key-value pairs.
    """
    # TODO: Implement the filter_even_values function
    pass