Python program to find if given co-ordinates are inside circle


Topic: Python program to find if given co-ordinates are inside circle

Solution

from random import uniform
from math import sqrt
def random_shot(rad):
    r_x = uniform(-rad, rad)
    r_y = uniform(-rad, rad)
    if sqrt(r_x**2 + r_y**2) <= rad:
        is_in_circle = True
    else:
        is_in_circle = False
    
    return r_x, r_y, is_in_circle



List all Python Programs