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 apr_interest function to financial #6025

Merged
merged 5 commits into from
Jun 19, 2023
Merged

Conversation

smturro2
Copy link
Contributor

@smturro2 smturro2 commented Mar 2, 2022

Describe your change:

In almost every scenario financial institutions will give the APR for a loan or credit card. This function allows you to calculate the interest without having to calculate the effective interest rate from the APR.

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

@ghost ghost added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Mar 2, 2022
@smturro2
Copy link
Contributor Author

smturro2 commented Apr 5, 2022

Hi, is there additional changes that need to be made to proceed with the pull request? Thanks!

@stale
Copy link

stale bot commented Jun 13, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Used to mark an issue or pull request stale. label Jun 13, 2022
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.

@cclauss I think this is good to merge as long as it passes the current workflows

@stale stale bot removed the stale Used to mark an issue or pull request stale. label Jun 18, 2023
@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Jun 18, 2023
@tianyizheng02
Copy link
Contributor

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

financial/interest.py:113: error: Argument 3 to "compound_interest" has incompatible type "float"; expected "int"  [arg-type]
Found 1 error in 1 file (checked 1192 source files)

pre-commit is failing because of a mypy error in a different function in the same file

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.

The compound_interest function call in apr_interest is causing mypy to fail because compound_interest takes an int for the number of compounding periods:

def compound_interest(
    principal: float,
    nominal_annual_interest_rate_percentage: float,
    number_of_compounding_periods: int,
) -> float:

We should change the type hint for number_of_compounding_periods from int to float.

@cclauss cclauss merged commit ea6c605 into TheAlgorithms:master Jun 19, 2023
sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* Added apr_interest function to financial

* Update interest.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update financial/interest.py

* float

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants