Develop a program in python to realize the following task:
Calculate the average of all the elements of an array.
def avg(arr):
    tot_sum = 0
    for num in arr:
        tot_sum += num
    
    return tot_sum/len(arr)