Find maximum element

Create a function that takes a vector of numbers as input and returns the maximum element in the vector.

Here, a vector is a one-dimensional Python list of numbers. Use a nonempty list of finite numbers and keep it unchanged. An empty list has no maximum and is outside this task.

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

Listing 1: Starter function and supplied checks for find maximum element.
def find_max_element(vector: list[float]) -> float:
    # Add code here!
    pass


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

    maximum = find_max_element(vector)
    assert maximum == 5


test_find_max_element()

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.