import math


def distance(x, y):
    """
    Compute the distance between two songs.

    Params:
        - x: First song dict
        - y: Second song dict
    Returns: The cartesian distance between the two songs.
    """
    return math.sqrt(
        (x["tempo"] - y["tempo"])**2 +
        (x["amplitude"] - y["amplitude"])**2 +
        (x["frequency"] - y["frequency"])**2 +
        (x["attack"] - y["attack"])**2
    )