Program to calculate Variance of first N Natural Numbers | Function to calculate Variance of first N natural numbers ; Driver Code
def find_Variance ( n ) : NEW_LINE INDENT numerator = n * n - 1 NEW_LINE ans = ( numerator * 1.0 ) / 12 NEW_LINE return ans NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 5 NEW_LINE a = find_Variance ( N ) NEW_LINE print ( " { 0 : . 6f } " . format ( a ) ) NEW_LINE DEDENT