Given a list of integers, write a Python program to calculate the average of all the numbers.
[2, 4, 6, 8, 10]
def average(lst):
 sum = 0
 for num in lst:
  sum += num

 return sum/len(lst)

nums = [2, 4, 6, 8, 10]
result = average(nums)
print(result) # 6.0