Element-wise multiplication

Create a function that takes two vectors of the same length as input and returns a new vector containing the element-wise multiplication of the input vectors.

A vector here is a list of numbers. Element-wise multiplication multiplies the values at matching positions. For example, [2, 3] and [5, 7] produce [10, 21]. Leave both input lists unchanged, and return a list in the original position order. Two empty input lists produce an empty list.

Present your algorithm in Python, pseudocode, or a flowchart. If you use Python, you may use zip to visit matching values as pairs. The starter and supplied checks are in Listing 1.

Listing 1: Starter function and supplied checks for multiplying values at matching vector positions.
def elementwise_multiply(
    vector1: list[float], vector2: list[float]
) -> list[float]:
    # Add code here!
    pass


def test_elementwise_multiply() -> None:
    # Input list 1
    vector1 = [1, 2, 3]

    # Input list 2
    vector2 = [4, 5, 6]

    result = elementwise_multiply(vector1, vector2)
    assert result[0] == 4
    assert result[1] == 10
    assert result[2] == 18


test_elementwise_multiply()