Convert this Java code sample to Python.
public int sumOfArray(int[] array) {
    int sum = 0; 
    for (int i = 0; i < array.length; i++) {
        sum += array[i];
    }
    return sum;
}
def sum_of_array(array):
    sum = 0 
    for i in range(len(array)):
        sum += array[i]
    return sum