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
i = 0
while i < 5 :
total = total + myArray[i]
i = i + 1
return total
Ignoring the operations to initialize total
, initialize i
, to set up the while
loop, and to return
the result, how many operations must be completed when the function is run with myArray = [38, 33, 82, 35, 88, 63, 88, 50]
?
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