Concatenate vectors

Create a function that takes two vectors as input and returns a new vector that is the result of concatenating the elements of the second vector to the end of the first vector. Do not modify either input vector.

Here, a vector is a one-dimensional Python list of numbers. Either input may be empty; the returned list is still a new list.

Complete the supplied function in Listing 1. Keep its signature and use the checks below it.

Listing 1: Starter function and supplied checks for concatenate vectors.
def concatenate_vectors(
    vector1: list[float], vector2: list[float]
) -> list[float]:
    # Add code here! You can extend a copy of vector1.
    pass


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

    # Input list 2
    vector2 = [6, 7, 8, 9, 10]

    concatenated = concatenate_vectors(vector1, vector2)
    assert len(concatenated) == 10
    assert concatenated[3] == 4
    assert concatenated[4] == 5
    assert concatenated[5] == 6
    assert concatenated[6] == 7


test_concatenate_vectors()

len(values) returns the number of elements, so len([3, 7]) is 2 and len([]) is 0. List indexing starts at 0: [3, 7][0] is 3. An index must refer to an existing element.

assert condition stops the check with an AssertionError when the condition is false.