<doocs>1524.Number of Sub-arrays With Odd Sum_1.py
def numOfSubarrays( arr: List[int]) -> int:
    MOD = int(1e9) + 7
    counter = [0] * 2
    s = ans = 0
    for v in arr:
        s += v
        counter[s % 2] += 1
        if s % 2 == 1:
            ans += 1 + counter[0]
        else:
            ans += counter[1]
    return ans % MOD
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_5 = int ( 1e9 ) + 7
    var_8 = [ 0 ] * 2
    var_10 = var_9 = 0
    for var_11 in var_0 :
        var_10 += var_11
        var_8 [ var_10 % 2 ] += 1
        if var_10 % 2 == 1 :
            var_9 += 1 + var_8 [ 0 ]
        else :
            var_9 += var_8 [ 1 ]
    return var_9 % var_5
