# sumArray: float[] -> float # Return the sum of all the numbers in the array `data`: # def sumArray( data ): totalSoFar = 0.0 for i in range( len(data) ): totalSoFar = totalSoFar + data[i] return totalSoFar # avgArray: float[] -> float # Return the average of all the numbers in the array `data`. # The array must be non-empty. # def avgArray( data ): return sumArray(data) / len(data) ########## scores = [ 0,0,0,0,0 ] # Yuck -- 0 isn't correct, but we must fill the array with *something*?! for hwNumber in range( len(scores) ): newScore = raw_input( "Enter score for hw#" + str(hwNumber+1) + " " ) scores[hwNumber] = int(newScore) print( "The scores are: " ) for hwNumber in range( len(scores) ): print( "hw#" + str(hwNumber+1) + ": " + str( scores[hwNumber] ) ) print("The average score is: " + str( avgArray( scores ) ) )