grades = [88, 99, 73, 56, 87, 64]sum = 00.upto(grades.length - 1) do |loop_index| sum += grades[loop_index]endaverage = sum / grades.lengthputs average