Edit the following Python code to calculate the average of an array of numbers.
arr = [3, 4, 5]
sum = 0
for i in arr:
    sum = sum + i
print(sum)
arr = [3, 4, 5]
sum = 0
for i in arr:
    sum = sum + i

average = sum / len(arr)
print(average)