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

digital root method #6140

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open

digital root method #6140

wants to merge 34 commits into from

Conversation

meg-1
Copy link
Contributor

@meg-1 meg-1 commented May 11, 2022

Describe your change:

added the 'digital_root' method to maths/sum_of_digits.py.
a digital root is: https://en.wikipedia.org/wiki/Digital_root

  • 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}.

@meg-1 meg-1 requested a review from Kush1101 as a code owner May 11, 2022
@algorithms-keeper algorithms-keeper bot added enhancement awaiting reviews labels May 11, 2022
@algorithms-keeper algorithms-keeper bot added the tests are failing label May 12, 2022
fixed syntax, readibility, indentation
@meg-1
Copy link
Contributor Author

@meg-1 meg-1 commented Jun 1, 2022

@poyea , sorry to disturb, the pre-commits in my pull requests keep failing although everything seems alright with the code. the workflow keeps telling me to add blank lines, but it never lets the checks go through even when i add them. could you please reccomend something to fix this issue?

fixed pre-commit issues
@poyea
Copy link
Member

@poyea poyea commented Jun 2, 2022

FAILED arithmetic_analysis/in_static_equilibrium.py::arithmetic_analysis.in_static_equilibrium.polar_force can be ignored. See #6170

poyea and others added 2 commits Jun 11, 2022
fixed the Value Error [ 73d line ]
@meg-1
Copy link
Contributor Author

@meg-1 meg-1 commented Jun 18, 2022

@Kush1101 could you please check out this pull request?

added an exception for an invalid input, as well as tests regarding it.
@meg-1
Copy link
Contributor Author

@meg-1 meg-1 commented Jul 2, 2022

@Kush1101 could you please check out this pull request?

try:
return n % 9 or n and 9 if n >= 0 else "Input wasn't valid"
except TypeError:
return "Please enter a non-negative integer"
Copy link
Member

@poyea poyea Jul 3, 2022

Choose a reason for hiding this comment

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

Suggested change
try:
return n % 9 or n and 9 if n >= 0 else "Input wasn't valid"
except TypeError:
return "Please enter a non-negative integer"
try:
return n % 9 or n and 9 if n >= 0 else "Input wasn't valid"
except TypeError:
return "Please enter a non-negative integer"

@poyea poyea self-assigned this Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews enhancement tests are failing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants