Probability for three randomly chosen numbers to be in AP | Function to calculate probability ; Driver code
def procal ( n ) : NEW_LINE INDENT return ( 3.0 * n ) / ( 4.0 * ( n * n ) - 1 ) NEW_LINE DEDENT a = [ 1 , 2 , 3 , 4 , 5 ] NEW_LINE n = len ( a ) NEW_LINE print ( round ( procal ( n ) , 6 ) ) NEW_LINE