0 of 464 solved

Function Composition

Write a function `compose(f, g)` that returns a new function representing the composition of `f` and `g`.

The returned function should call `g` first and then pass that result to `f`.

#### Example
Input: `compose(double, negate)(5)`
Output: `-10`
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