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

merge double_factorial #9431

Merged

Conversation

AVAniketh0905
Copy link
Contributor

@AVAniketh0905 AVAniketh0905 commented Oct 2, 2023

Describe your change:

Contributes to #8098

  • Deleted maths/double_factorial_iterative.py and maths/double_factorial_irecursive.py.
  • Created maths/double_factorial.py. Which inlcudes the above 2 implementations.
  • Changed the DIRECTORY.md to include only double_factorial.py file.
  • 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 include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files require descriptive names This PR needs descriptive function and/or variable names labels Oct 2, 2023
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

maths/double_factorial.py Show resolved Hide resolved
@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Oct 2, 2023
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

maths/double_factorial.py Show resolved Hide resolved
@AVAniketh0905
Copy link
Contributor Author

I have changed a doctest to satisfy for ruff error.

@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 2, 2023
Copy link
Contributor

@tianyizheng02 tianyizheng02 left a comment

Choose a reason for hiding this comment

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

  1. Please do not edit DIRECTORY.md. This file is auto-generated with a script.
  2. Please keep the original doctest that you changed. Ruff was failing on that line because the line was too long, not because the test was incorrect.

Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

maths/double_factorial.py Show resolved Hide resolved
@AVAniketh0905
Copy link
Contributor Author

  1. Please do not edit DIRECTORY.md. This file is auto-generated with a script.
  2. Please keep the original doctest that you changed. Ruff was failing on that line because the line was too long, not because the test was incorrect.

@tianyizheng02 Sorry I didnt know about DIRECTORY.md. I have reverted my changes. Now can you check?

@algorithms-keeper algorithms-keeper bot added the tests are failing Do not merge until tests pass label Oct 3, 2023
@tianyizheng02
Copy link
Contributor

@AVAniketh0905 Please fix the failing ruff errors. Some lines are too long.

@AVAniketh0905
Copy link
Contributor Author

@AVAniketh0905 Please fix the failing ruff errors. Some lines are too long.

The current test case is indeed exceeding the ruff limit. So can I change the test case?

# Old Test Case
all(double_factorial_iterative(i) == math.prod(range(i, 0, -2)) for i in range(20))
True

# New Test Case
double_factorial_iterative(5) == math.prod(range(5, 0, -2))
True

If you confirm ill do the necessary changes...
Srry this is taking too long...

@tianyizheng02
Copy link
Contributor

No, I already said not to change the test case. Please break that test case into multiple lines if it's too long.

Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

maths/double_factorial.py Show resolved Hide resolved
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

maths/double_factorial.py Show resolved Hide resolved
@AVAniketh0905
Copy link
Contributor Author

No, I already said not to change the test case. Please break that test case into multiple lines if it's too long.

yes sorry i didnt know we could do that.

Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

maths/double_factorial.py Show resolved Hide resolved
@algorithms-keeper algorithms-keeper bot removed the tests are failing Do not merge until tests pass label Oct 3, 2023
@tianyizheng02
Copy link
Contributor

I modified your PR description to say "Contributes to..." rather than "Fixes..." because the latter will automatically close the issue. This PR helps with the issue but doesn't fix it completely.

@tianyizheng02 tianyizheng02 merged commit b60a94b into TheAlgorithms:master Oct 3, 2023
3 checks passed
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Oct 3, 2023
@AVAniketh0905
Copy link
Contributor Author

I modified your PR description to say "Contributes to..." rather than "Fixes..." because the latter will automatically close the issue. This PR helps with the issue but doesn't fix it completely.

I understand. Thank you for taking your time reviewing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This PR modified some existing files require descriptive names This PR needs descriptive function and/or variable names
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants