Find probability that a player wins when probabilities of hitting the target are given | Function to return the probability of the winner ; Driver Code ; Will print 9 digits after the decimal point
def find_probability ( p , q , r , s ) : NEW_LINE INDENT t = ( 1 - p / q ) * ( 1 - r / s ) NEW_LINE ans = ( p / q ) / ( 1 - t ) ; NEW_LINE return round ( ans , 9 ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT p , q , r , s = 1 , 2 , 1 , 2 NEW_LINE print ( find_probability ( p , q , r , s ) ) NEW_LINE DEDENT