mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Travis CI: Fix Travis linter errors (#1802)
* Travis CI: Fix Travis linter errors * fixup! Format Python code with psf/black push * Update .travis.yml * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
1bc84e1fa0
commit
ab3400bfad
|
@ -1,3 +1,5 @@
|
|||
os: linux
|
||||
dist: bionic
|
||||
language: python
|
||||
python: 3.8
|
||||
cache: pip
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -18,7 +18,8 @@ class Point:
|
|||
"""
|
||||
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 @@ if __name__ == "__main__":
|
|||
|
||||
# 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)}")
|
||||
|
|
Loading…
Reference in New Issue
Block a user