(x: float, y: float)
| 22 | |
| 23 | # A local function to see if a dot lands in the circle. |
| 24 | def is_in_circle(x: float, y: float) -> bool: |
| 25 | distance_from_centre = sqrt((x**2) + (y**2)) |
| 26 | # Our circle has a radius of 1, so a distance |
| 27 | # greater than 1 would land outside the circle. |
| 28 | return distance_from_centre <= 1 |
| 29 | |
| 30 | # The proportion of guesses that landed in the circle |
| 31 | proportion = mean( |