Edit the following Python program to make it run without any syntax errors.
def sum(alist)
    total 0
    for i in range alist
        total += i
    return total
def sum(alist):
    total = 0
    for i in alist:
        total += i
    return total