Edit a given Python code to return the maximum number in the given array.
arr = [7, 8, 2, 4]
def findMax(arr):
    max = arr[0]
    for num in arr:
        if num > max:
            max = num
    return max

print(findMax(arr))