Function that summation of absolute differences of all pairs raised to the power k
def pairsPower ( self ) : NEW_LINE INDENT pre = [ ] NEW_LINE for i in range ( self . n + 1 ) : NEW_LINE INDENT temp = [ ] NEW_LINE for j in range ( self . k + 1 ) : NEW_LINE INDENT temp . append ( 0 ) NEW_LINE DEDENT pre . append ( temp ) NEW_LINE DEDENT ans = 0 NEW_LINE DEDENT