Optimize a Python function that returns the value at the index of an array (list) of size n.
[20, 30, 50, 70, 90]
def getValueAtIndex(arr, index):
    return arr[index] if index >= 0 and index < len(arr) else 0

print(getValueAtIndex([20, 30, 50, 70, 90], 3)) # 70