Coding Quiz
In this coding quiz, your task is to implement the solution
function, which returns the element at a specified index from a given numeric array.
This function takes a numeric array numbers
and an index index
as parameters, then returns the element located at the specified index of the array.
Parameter Format
def solution(numbers, index):
# Write your code here
return
Constraints
-
numbers
is a list of numerical values. -
index
is an integer that is greater than or equal to 0 and less than the length of thenumbers
list. -
The function must return the element at the specified index.
Example Input/Output
-
Input:
solution([1, 2, 3, 4, 5], 2)
-
Output:
3
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.