human
Probability of a key K present in array | Function to find the probability.
find probability upto 2 decimal places.
Driver Code"
Solution in Python:
 ... Write me a code to probability of a key K present in array and the other steps required?
assistant
#Here is code to probability of a key K present in array and the other steps required.
 def kPresentProbability ( a , n , k ) :
	count = a . count ( k )
	return round ( count / n , 2 )
if __name__ == " _ _ main _ _ " :
	A = [ 4 , 7 , 2 , 0 , 8 , 7 , 5 ]
	K = 2
	N = len ( A )
	print ( kPresentProbability ( A , N , K ) )