Consider the following function which takes an array as input and returns a single numeric value as output. You may assume that all array values are small enough that they can be stored in a typical integer data type.
def sum_first_five(myArray):
total = 0
for i in [0, 1, 2, 3, 4]:
total = total + myArray[i]
return total
Ignoring the operations to initialize total
, to set up the for
loop, and to return
the result how many operations must be completed when the function is run with myArray = [65, 36, 36, 37, 34, 78, 87, 65, 55]
?
Box 1: Enter your answer as an integer or decimal number. Examples: 3, -4, 5.5172
Enter DNE for Does Not Exist, oo for Infinity