python generate all numbers that sum to n code example
Example 1: sum of 2 numbers in python
a = int(input("Enter first number:"))
b = int(input("Enter second number:"))
sum = a+b
print(sum)
Example 2: sum every ith element numpy
import numpy as np
c = [1, 0, 0, 0, 0, 2, 0, 0, 0, 0]
np.add.reduceat(c, np.arange(0, len(c), 5))
# array([1, 2])