Program for weighted mean of natural numbers . | Returns weighted mean assuming for numbers 1 , 2 , . . n and weights 1 , 2 , . . n ; Driver program to test the function .
def weightedMean ( n ) : NEW_LINE INDENT return ( 2 * n + 1 ) / 3 NEW_LINE DEDENT n = 10 NEW_LINE print ( int ( weightedMean ( n ) ) ) NEW_LINE