Hello i have to do a function. I try something but it doesn't work so i ask for help please.
Here are the instructions :
Write a max_and_index function that takes a non-empty array tab
(Python type list) of integers and returns the value of the largest element of theand the index of its first appearance in the array.
Use of the native max function is not permitted.
Examples:
max_and_index([1, 5, 6, 9, 1, 2, 3, 7, 9, 8])
(9, 3)max_and_index([-2])
(-2, 0)
max_and_index([-1, -1, 3, 3, 3])
(3, 2)
max_and_index([1, 1, 1, 1])
(1, 0)
Also i post what i tried.