Write a function inCircle that takes a point and a radius as a parameter. The function should return True if the point is inside the circle and False otherwise.
# This function inCircle takes a point and a radius as a parameter.
# The function returns True if the point is inside the circle and False otherwise.
def inCircle(pointX,pointY, circleRadius):
  if (pointX * pointX + pointY * pointY )<= (circleRadius * circleRadius):Â
    return TrueÂ
  else:Â
    return False
#Tests
print("The point is inside the circle: inCircle(5,5,2): "+str(inCircle(5,5,2))) #False
print("The point is inside the circle: inCircle(5,5,15): "+str(inCircle(5,5,15)))#True
Comments
Leave a comment