Exercise 4: Replace an Element in the Array

Replace an element in the array.

We'll cover the following

Problem statement

Given an array of at least size four, add a line in the code below so that the program returns 99 when executed.

Note: You can only insert code at line 3, and you can’t make changes to existing lines of code.

Try it yourself

Press + to interact
def replace_element(input_array)
# Start your code here
return input_array[3]
end