human
Number of anomalies in an array | A simple Python3 solution to count anomalies in an array ..
Driver Code"
Solution in Python:
assistant
#Here is code to number of anomalies in an array and the other steps required.
 def countAnomalies ( arr , n , k ) :
	res = 0
	for i in range ( 0 , n ) :
		j = 0
		while j < n :
			if i != j and abs ( arr [ i ] - arr [ j ] ) <= k :
				break
			j += 1
		if j == n :
			res += 1
	return res
if __name__ == " _ _ main _ _ " :
	arr = [ 7 , 1 , 8 ]
	k = 5
	n = len ( arr )
	print ( countAnomalies ( arr , n , k ) )