Create a function to find the mean of a given array in Python.
[2, 4, 5, 7]
def mean(arr): 
  return sum(arr)/len(arr)

arr = [2, 4, 5, 7]
mean_val = mean(arr)
print("Mean of the array is", mean_val)
# Output: Mean of the array is 4.5