human
Count points from an array that lies inside a semi | Python implementation of above approach.
Traverse the array.
Stores if a point lies above the diameter or not.
Stores if the R is less than or equal to the distance between center and point.
Driver Code"
How can the above be solved in Python?
 What is a code to count points from an array that lies inside a semi and the other steps required?
assistant
#Here is code to count points from an array that lies inside a semi and the other steps required.
 def getPointsIns ( x1 , y1 , radius , x2 , y2 , points ) :
	for point in points :
		condOne = ( point [ 1 ] - y2 ) * ( x2 - x1 ) - ( y2 - y1 ) * ( point [ 0 ] - x2 ) >= 0
		condTwo = radius >= ( ( y1 - point [ 1 ] ) ** 2 + ( x1 - point [ 0 ] ) ** 2 ) ** ( 0.5 )
		if condOne and condTwo :
			ans += 1
	return ans
X = 0
Y = 0
R = 5
P = 5
Q = 0
arr = [ [ 2 , 3 ] , [ 5 , 6 ] , [ - 1 , 4 ] , [ 5 , 5 ] ]
print ( getPointsIns ( X , Y , R , P , Q , arr ) )