Produce a Python code for finding the largest element in an array.
[40, 50, 11, 70, 39]
def find_max(arr):
    max = arr[0]
    for i in range(1,len(arr)):
        if arr[i] > max:
            max = arr[i]
    return max

result = find_max([40, 50, 11, 70, 39])
print(result)