Create a Python program to compute the average of all the numbers in a list.
[1, 5, 9.7, 8, 5.6]
def avg(list):
    if len(list) == 0:
        return 0
    else:
        sum = 0
        for num in list:
            sum += num
        return sum / len(list)