Made improvements to combinations.py by Rolv-Apneseth · Pull Request #3681 · TheAlgorithms/Python · GitHub
Skip to content

Made improvements to combinations.py - #3681

Merged
realDuYuanChao merged 4 commits into
TheAlgorithms:masterfrom
Rolv-Apneseth:change-combinations.py
Oct 26, 2020
Merged

realDuYuanChao merged 4 commits into
TheAlgorithms:masterfrom
Rolv-Apneseth:change-combinations.py

Conversation

@Rolv-Apneseth

Copy link
Copy Markdown
Contributor

I have made some improvements to combinations.py.

Added:

  • A description at the top, which includes a wikipedia link
  • Type hints to the combinations function
  • Some more doctests, which include 0 and negative numbers
  • A check within the function so the function does not attempt to get factorials of negative numbers
  • Some print statements in the main block which show some practical applications of the function

If you would like anything else, or if you don't like the changes, please let me know. Thanks!

@Rolv-Apneseth

Copy link
Copy Markdown
Contributor Author

Comment thread maths/combinations.py Outdated

@realDuYuanChao realDuYuanChao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct!

Comment thread maths/combinations.py Outdated
Comment thread maths/combinations.py
@realDuYuanChao
realDuYuanChao merged commit 8f81c46 into TheAlgorithms:master Oct 26, 2020
@realDuYuanChao

Copy link
Copy Markdown
Member

@Rolv-Apneseth Thanks for your contribution :)

@Rolv-Apneseth

Copy link
Copy Markdown
Contributor Author

stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* Made improvements to combinations.py

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Function now raises an error when given invalid input

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
peRFectBeliever pushed a commit to peRFectBeliever/Python that referenced this pull request Apr 1, 2021
* Made improvements to combinations.py

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Function now raises an error when given invalid input

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
* Made improvements to combinations.py

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Function now raises an error when given invalid input

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* Made improvements to combinations.py

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Function now raises an error when given invalid input

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.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.

2 participants