Product of all Subsets of a set formed by first N natural numbers | Function to find the product of all elements in all subsets in natural numbers from 1 to N ; Driver Code
def product ( N ) : NEW_LINE INDENT ans = 1 ; NEW_LINE val = 2 ** ( N - 1 ) ; NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT ans *= ( i ** val ) ; NEW_LINE DEDENT return ans ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 2 ; NEW_LINE print ( product ( N ) ) ; NEW_LINE DEDENT