From 5aa53ea26d635950c9538559cd3d3dbfa634bfdc Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 14 Mar 2020 08:44:01 +0100 Subject: [PATCH 1/4] Travis CI: Fix Travis linter errors --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index aec411c52507..44b4b38b90b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ + +os: linux +dist: bionic language: python python: 3.8 cache: pip From 5f1b7721abf93a9908a698d4cdd8cf4e38b4f9cc Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 14 Mar 2020 07:44:30 +0000 Subject: [PATCH 2/4] fixup! Format Python code with psf/black push --- maths/pi_monte_carlo_estimation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maths/pi_monte_carlo_estimation.py b/maths/pi_monte_carlo_estimation.py index 7f341ade94a4..d91c034cce12 100644 --- a/maths/pi_monte_carlo_estimation.py +++ b/maths/pi_monte_carlo_estimation.py @@ -18,7 +18,8 @@ def random_unit_square(cls): """ Generates a point randomly drawn from the unit square [0, 1) x [0, 1). """ - return cls(x = random.random(), y = random.random()) + return cls(x=random.random(), y=random.random()) + def estimate_pi(number_of_simulations: int) -> float: """ @@ -56,6 +57,7 @@ def estimate_pi(number_of_simulations: int) -> float: # doctest.testmod() from math import pi + prompt = "Please enter the desired number of Monte Carlo simulations: " my_pi = estimate_pi(int(input(prompt).strip())) print(f"An estimate of PI is {my_pi} with an error of {abs(my_pi - pi)}") From 485f415204e8e123ab11f2a32accd0490fbf7e0c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 14 Mar 2020 08:45:19 +0100 Subject: [PATCH 3/4] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 44b4b38b90b6..b9c47c179dee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ - os: linux dist: bionic language: python From 87527b2876aab4ccdefdc3bf27eba7ee09f4d389 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Sat, 14 Mar 2020 07:45:36 +0000 Subject: [PATCH 4/4] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 8dd9fa929255..121b4df17c85 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -321,6 +321,7 @@ * [Newton Raphson](https://github.com/TheAlgorithms/Python/blob/master/maths/newton_raphson.py) * [Numerical Integration](https://github.com/TheAlgorithms/Python/blob/master/maths/numerical_integration.py) * [Perfect Square](https://github.com/TheAlgorithms/Python/blob/master/maths/perfect_square.py) + * [Pi Monte Carlo Estimation](https://github.com/TheAlgorithms/Python/blob/master/maths/pi_monte_carlo_estimation.py) * [Polynomial Evaluation](https://github.com/TheAlgorithms/Python/blob/master/maths/polynomial_evaluation.py) * [Prime Check](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_check.py) * [Prime Factors](https://github.com/TheAlgorithms/Python/blob/master/maths/prime_factors.py)