Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a binomial distribution formula calculator algorithm #2197

Merged
merged 10 commits into from
Jul 13, 2020
Merged

Added a binomial distribution formula calculator algorithm #2197

merged 10 commits into from
Jul 13, 2020

Conversation

SamiTumarov
Copy link
Contributor

@SamiTumarov SamiTumarov commented Jul 13, 2020

Describe your change:

Added a binomial distribution algorithm
(also added in the same file a factorial function that is being used
by the binomial distribution function)

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@TravisBuddy
Copy link

Hey @XxSamixX123,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 077b4d80-c4fe-11ea-af19-3b271fec1f42

@cclauss
Copy link
Member

cclauss commented Jul 13, 2020

Codespell says: ./maths/binomial_distribution.py:14: succes ==> success

@TravisBuddy
Copy link

Hey @XxSamixX123,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 7271d190-c50d-11ea-af19-3b271fec1f42

Comment on lines 64 to 66
print ("Probability of 2 successes out of 4 trails")
print ("with probability of 0.75 is : ")
print (str(binomial_distribution(2, 4, 0.75)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leave these three lines in place if you want.

Co-authored-by: Christian Clauss <cclauss@me.com>
@TravisBuddy
Copy link

Hey @XxSamixX123,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: f844ef30-c50f-11ea-af19-3b271fec1f42

@cclauss
Copy link
Member

cclauss commented Jul 13, 2020

Travis CI says...

$ flake8 --ignore=E203,W503 --max-complexity=25 --max-line-length=88 --statistics --count .

./maths/binomial_distribution.py:29:36: E226 missing whitespace around arithmetic operator
./maths/binomial_distribution.py:29:39: E226 missing whitespace around arithmetic operator
./maths/binomial_distribution.py:29:54: E226 missing whitespace around arithmetic operator
./maths/binomial_distribution.py:33:41: E226 missing whitespace around arithmetic operator
./maths/binomial_distribution.py:33:58: E226 missing whitespace around arithmetic operator
./maths/binomial_distribution.py:52:24: E226 missing whitespace around arithmetic operator
./maths/binomial_distribution.py:56:1: E305 expected 2 blank lines after class or function definition, found 1
6     E226 missing whitespace around arithmetic operator
1     E305 expected 2 blank lines after class or function definition, found 1
7

@TravisBuddy
Copy link

Travis tests have failed

Hey @XxSamixX123,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: a984f2c0-c51c-11ea-af19-3b271fec1f42

SamiTumarov and others added 2 commits July 13, 2020 18:32
@TravisBuddy
Copy link

Travis tests have failed

Hey @XxSamixX123,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 2e38e4c0-c51f-11ea-af19-3b271fec1f42

@cclauss
Copy link
Member

cclauss commented Jul 13, 2020

I think we are close to landing this one.... Just a few todos.

  1. Edit the first message at the top of this page to set the markdown checkboxes correctly
  2. Let's from math import factorial and remove your version
  3. Fix the mypy error that is failing on Travis CI

maths/binomial_distribution.py:33: error: Incompatible types in assignment (expression has type "float", variable has type "int")

@TravisBuddy
Copy link

Hey @XxSamixX123,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 480ea490-c531-11ea-af19-3b271fec1f42

@SamiTumarov
Copy link
Contributor Author

succes

I'm quite sure that was fixed earlier.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work. Thanks for your persistence. You did fix all issues. My commit was just formatting.

@cclauss cclauss merged commit 749ffd8 into TheAlgorithms:master Jul 13, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
…thms#2197)

* Add files via upload

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants