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_six(myArray):
total = 0
i = 0
while i < 6 :
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 = [45, 74, 47, 72, 83, 60, 40, 85, 44]
?