def unit_vector(vector):
    """
    Calculate a unit vector in the same direction as the input vector.

    Args:
        vector (list): The input vector.

    Returns:
        list: The unit vector.
    """
    length = sum([v ** 2 for v in vector]) ** 0.5
    unit_vector_ = [v / length for v in vector]
    return unit_vector_