human
Write a python function to find the sum of all odd length subarrays. https://www.geeksforgeeks.org/sum-of-all-odd-length-subarrays/ Here is a solution in Python:
=====
Give me a Python code to find the sum of all odd length subarrays?
assistant
#Here is Python code to find the sum of all odd length subarrays.
 def odd_length_sum(arr):
    Sum = 0
    l = len(arr)
    for i in range(l):
        Sum += ((((i + 1) *(l - i) + 1) // 2) * arr[i])
    return Sum