Sum of all the numbers in the Nth row of the given triangle | Function to return the sum of the nth row elements of the given triangle ; Driver code
def getSum ( n ) : NEW_LINE INDENT return ( ( n - 1 ) + pow ( n , 2 ) ) ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 3 ; NEW_LINE print ( getSum ( n ) ) ; NEW_LINE DEDENT