human
Sum of products of all combination taken ( 1 to n ) at a time | to store sum of every combination.
if we have reached sufficient depth.
find the product of combination.
add the product into sum.
recursion to produce different combination.
function to print sum of products of all combination taken 1 - N at a time.
creating temporary array for storing combination.
call combination with r = i for combination taken i at a time.
displaying sum.
Driver Code.
storing numbers from 1 - N in array.
calling allCombination"
How can the above be solved in Python?
 ... What is a code to sum of products of all combination taken ( 1 to n ) at a time and the other steps required?
assistant
#Here is code to sum of products of all combination taken ( 1 to n ) at a time and the other steps required.
 def Combination ( a , combi , n , r , depth , index ) :
	global Sum
	if index == r :
		product = 1
		for i in range ( r ) :
			product = product * combi [ i ]
		Sum += product
		return
	for i in range ( depth , n ) :
		combi [ index ] = a [ i ]
		Combination ( a , combi , n , r , i + 1 , index + 1 )
def allCombination ( a , n ) :
	global Sum
	for i in range ( 1 , n + 1 ) :
		combi = [ 0 ] * i
		Combination ( a , combi , n , i , 0 , 0 )
		print ( " f ( " , i , " ) ▁ - - > ▁ " , Sum )
		Sum = 0
Sum = 0
n = 5
a = [ 0 ] * n
for i in range ( n ) :
	a [ i ] = i + 1
allCombination ( a , n )