0 out of 68 challenges solved

Function composition by taking two functions as input and returning a composed function

Question:
Write a function called compose that takes two functions as input and performs function composition. The composed function should first call the second function and then the first function on its argument. The function should return the composed function.

Example:
Input: compose(double, negate)
Output: A function that first calls negate and then double on its argument

def compose(f, g):
    """
    Performs function composition by taking two functions as input and returning a composed function.

    Args:
    f: The first function.
    g: The second function.

    Returns:
    function: The composed function.
    """
    # TODO: Implement the compose function
    pass