Optimize the given code using any of the data structure available in Python.
def add(array):
    sum = 0
    
    for i in range(len(array)):
        sum = sum + array[i]
    return sum
def add(array):
    sum = 0
    
    for element in array:
        sum = sum + element
    return sum