Skip to content

Instantly share code, notes, and snippets.

@klahrich
Created April 10, 2020 17:28
Show Gist options
  • Save klahrich/c202ff0ba77191975bff93d8d9f1370c to your computer and use it in GitHub Desktop.
Save klahrich/c202ff0ba77191975bff93d8d9f1370c to your computer and use it in GitHub Desktop.
def pi():
# Number of darts that land inside.
inside = 0
# Total number of darts to throw.
total = 1000000
# Iterate for the number of darts.
for i in range(0, total):
inside += is_inside()
return (inside / total) * 4
pi()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment