Answer to Question #162576 in Python for Rukiyah

Question #162576

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.



1
Expert's answer
2021-02-10T01:08:15-0500
# 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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS