From aebdf15565eb3c6b89bbafe70304be679b3137d3 Mon Sep 17 00:00:00 2001 From: Umang Dadhich Date: Wed, 13 Aug 2025 11:20:20 +0530 Subject: [PATCH 01/11] =?UTF-8?q?Fix=20formatting=20and=20grammar=20in=20C?= =?UTF-8?q?ONTRIBUTING.md=20=F0=9F=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 61 +++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3df39f95b784..bb15086fbd57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ -# Contributing guidelines +# Contributing Guidelines -## Before contributing +## Before Contributing -Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before submitting your pull requests, please ensure that you __read the whole guidelines__. If you have any doubts about the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community on [Gitter](https://gitter.im/TheAlgorithms/community). +Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before submitting your pull requests, please ensure that you __read the entire guidelines__. If you have any doubts about the contributing guide, please feel free to [state them clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community on [Gitter](https://gitter.im/TheAlgorithms/community). ## Contributing @@ -10,28 +10,28 @@ Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Befo We are delighted that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. By being one of our contributors, you agree and confirm that: -- You did your work - no plagiarism allowed. +- You did your work — no plagiarism allowed. - Any plagiarized work will not be merged. -- Your work will be distributed under [MIT License](LICENSE.md) once your pull request is merged. +- Your work will be distributed under the [MIT License](LICENSE.md) once your pull request is merged. - Your submitted work fulfills or mostly fulfills our styles and standards. -__New implementation__ is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity, but __identical implementation__ of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request. +__New implementations__ are welcome! For example, new solutions for a problem, different representations for a graph data structure, or algorithm designs with different complexities. However, __identical implementations__ of an existing one are not allowed. Please check whether the solution is already implemented before submitting your pull request. __Improving comments__ and __writing proper tests__ are also highly welcome. ### Contribution -We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work. +We appreciate any contribution — from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work. -Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, then click on the ___details___ button to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help. +Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page. If those tests fail, click on the ___details___ button to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page and a community member will try to help. #### Issues -If you are interested in resolving an [open issue](https://github.com/TheAlgorithms/Python/issues), simply make a pull request with your proposed fix. __We do not assign issues in this repo__ so please do not ask for permission to work on an issue. +If you are interested in resolving an [open issue](https://github.com/TheAlgorithms/Python/issues), simply make a pull request with your proposed fix. __We do not assign issues in this repo__, so please do not ask for permission to work on an issue. __Do not__ create an issue to contribute an algorithm. Please submit a pull request instead. -Please help us keep our issue list small by adding `Fixes #{$ISSUE_NUMBER}` to the description of pull requests that resolve open issues. +Please help us keep our issue list small by adding `Fixes #{$ISSUE_NUMBER}` to the description of pull requests that resolve open issues. For example, if your pull request fixes issue #10, then please add the following to its description: ``` Fixes #10 @@ -40,27 +40,27 @@ GitHub will use this tag to [auto-close the issue](https://docs.github.com/en/is #### What is an Algorithm? -An Algorithm is one or more functions (or classes) that: +An algorithm is one or more functions (or classes) that: * take one or more inputs, * perform some internal calculations or data manipulations, * return one or more outputs, -* have minimal side effects (Ex. `print()`, `plot()`, `read()`, `write()`). +* have minimal side effects (e.g., `print()`, `plot()`, `read()`, `write()`). -Algorithms should be packaged in a way that would make it easy for readers to put them into larger programs. +Algorithms should be packaged in a way that would make it easy for readers to integrate them into larger programs. Algorithms should: -* have intuitive class and function names that make their purpose clear to readers -* use Python naming conventions and intuitive variable names to ease comprehension -* be flexible to take different input values -* have Python type hints for their input parameters and return values -* raise Python exceptions (`ValueError`, etc.) on erroneous input values -* have docstrings with clear explanations and/or URLs to source materials -* contain doctests that test both valid and erroneous input values -* return all calculation results instead of printing or plotting them - -Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value. - -#### Pre-commit plugin +* have intuitive class and function names that make their purpose clear to readers, +* use Python naming conventions and intuitive variable names to ease comprehension, +* be flexible to take different input values, +* have Python type hints for their input parameters and return values, +* raise Python exceptions (`ValueError`, etc.) on erroneous input values, +* have docstrings with clear explanations and/or URLs to source materials, +* contain doctests that test both valid and erroneous input values, +* return all calculation results instead of printing or plotting them. + +Algorithms in this repo should not be simple how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. These calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value. + +#### Pre-Commit Plugin Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style: ```bash @@ -68,11 +68,9 @@ python3 -m pip install pre-commit # only required the first time pre-commit install ``` That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files: - ```bash pre-commit run --all-files --show-diff-on-failure ``` - #### Coding Style We want your work to be readable by others; therefore, we encourage you to note the following: @@ -85,20 +83,17 @@ We want your work to be readable by others; therefore, we encourage you to note - We encourage the use of Python [f-strings](https://realpython.com/python-f-strings/#f-strings-a-new-and-improved-way-to-format-strings-in-python) where they make the code easier to read. -- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. To use it, - +- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. + - To use it: ```bash python3 -m pip install black # only required the first time black . ``` - -- All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request. - + - All submissions will need to pass the test `ruff .` before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request. ```bash python3 -m pip install ruff # only required the first time ruff check ``` - - Original code submission require docstrings or comments to describe your work. - More on docstrings and comments: From a80369d0d6598904cd3631faae4551c718578f7f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 05:59:44 +0000 Subject: [PATCH 02/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb15086fbd57..44b866ad060a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ If you are interested in resolving an [open issue](https://github.com/TheAlgorit __Do not__ create an issue to contribute an algorithm. Please submit a pull request instead. -Please help us keep our issue list small by adding `Fixes #{$ISSUE_NUMBER}` to the description of pull requests that resolve open issues. +Please help us keep our issue list small by adding `Fixes #{$ISSUE_NUMBER}` to the description of pull requests that resolve open issues. For example, if your pull request fixes issue #10, then please add the following to its description: ``` Fixes #10 From 20b90e5d7c366a54a3ffcf0d4bd9f778c849260c Mon Sep 17 00:00:00 2001 From: umang-dadhich Date: Sun, 6 Sep 2026 16:48:31 +0000 Subject: [PATCH 03/11] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 55af355f7fc0..94708f51262c 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -975,6 +975,7 @@ * [Lorentz Transformation Four Vector](physics/lorentz_transformation_four_vector.py) * [Malus Law](physics/malus_law.py) * [Mass Energy Equivalence](physics/mass_energy_equivalence.py) + * [Maxwells Equations](physics/maxwells_equations.py) * [Mirror Formulae](physics/mirror_formulae.py) * [N Body Simulation](physics/n_body_simulation.py) * [Newtons Law Of Gravitation](physics/newtons_law_of_gravitation.py) From bb667a3d7c41ee88323102bff6faa9c0d2e7c441 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 10 Sep 2026 04:58:34 +0000 Subject: [PATCH 04/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CONTRIBUTING.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6edaa22d1bbf..43fe0144c22e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,12 +45,12 @@ GitHub will use this tag to [auto-close the issue](https://docs.github.com/en/is #### What is an Algorithm? An algorithm is one or more functions (or classes) that: -* take one or more inputs, -* perform some internal calculations or data manipulations, -* return one or more outputs, -* have minimal side effects (e.g., `print()`, `plot()`, `read()`, `write()`). -An Algorithm is one or more functions (or classes) that: +- take one or more inputs, +- perform some internal calculations or data manipulations, +- return one or more outputs, +- have minimal side effects (e.g., `print()`, `plot()`, `read()`, `write()`). +An Algorithm is one or more functions (or classes) that: - take one or more inputs, - perform some internal calculations or data manipulations, - return one or more outputs, @@ -59,14 +59,15 @@ An Algorithm is one or more functions (or classes) that: Algorithms should be packaged in a way that would make it easy for readers to integrate them into larger programs. Algorithms should: -* have intuitive class and function names that make their purpose clear to readers, -* use Python naming conventions and intuitive variable names to ease comprehension, -* be flexible to take different input values, -* have Python type hints for their input parameters and return values, -* raise Python exceptions (`ValueError`, etc.) on erroneous input values, -* have docstrings with clear explanations and/or URLs to source materials, -* contain doctests that test both valid and erroneous input values, -* return all calculation results instead of printing or plotting them. + +- have intuitive class and function names that make their purpose clear to readers, +- use Python naming conventions and intuitive variable names to ease comprehension, +- be flexible to take different input values, +- have Python type hints for their input parameters and return values, +- raise Python exceptions (`ValueError`, etc.) on erroneous input values, +- have docstrings with clear explanations and/or URLs to source materials, +- contain doctests that test both valid and erroneous input values, +- return all calculation results instead of printing or plotting them. Algorithms in this repo should not be simple how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. These calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value. @@ -92,6 +93,7 @@ Use [pre-commit](https://pre-commit.com/#installation) to automatically format y python3 -m pip install pre-commit # only required the first time pre-commit install ``` + That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files: That's it! The plugin will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files: @@ -99,6 +101,7 @@ That's it! The plugin will run every time you commit any changes. If any errors ```bash pre-commit run --all-files --show-diff-on-failure ``` + #### Coding Style We want your work to be readable by others; therefore, we encourage you to note the following: @@ -125,6 +128,7 @@ We want your work to be readable by others; therefore, we encourage you to note python3 -m pip install ruff # only required the first time ruff check ``` + - Original code submission require docstrings or comments to describe your work. - Original code submissions require docstrings or comments to describe your work. From 3fadd8f0ec9fe3a4ff85fb25ee4a0f438b7105ac Mon Sep 17 00:00:00 2001 From: Umang Dadhich <140299516+umang-dadhich@users.noreply.github.com> Date: Thu, 10 Sep 2026 11:23:52 +0530 Subject: [PATCH 05/11] commited --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43fe0144c22e..a289b5b949dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Befo ## Contributing -### Contributor +### Contributor We are delighted that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. By being one of our contributors, you agree and confirm that: From b245e9004bd7460c7760beca08737cab9e25d0cf Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 10 Sep 2026 05:54:04 +0000 Subject: [PATCH 06/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a289b5b949dd..43fe0144c22e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Befo ## Contributing -### Contributor +### Contributor We are delighted that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. By being one of our contributors, you agree and confirm that: From 45e929e4f4233e12b378b6743dd2dd3ee63e64b0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 10 Sep 2026 14:55:49 +0200 Subject: [PATCH 07/11] Warp long line 72 to placate rumdl in pre-commit CONTRIBUTING.md:72:351: [MD013] Line length 376 exceeds 350 characters --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43fe0144c22e..4eec1f271796 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,8 @@ Algorithms should: - contain doctests that test both valid and erroneous input values, - return all calculation results instead of printing or plotting them. -Algorithms in this repo should not be simple how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. These calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value. +Algorithms in this repo should not be simple how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. +These calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value. #### Pre-Commit Plugin From 708557a30862141cd31bda55d93550f9e6536132 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 10 Sep 2026 15:10:44 +0200 Subject: [PATCH 08/11] Revise pre-commit instructions and docstring guidelines Updated the CONTRIBUTING.md file to clarify pre-commit plugin usage and improve docstring requirements. --- CONTRIBUTING.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4eec1f271796..5df423840d96 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,7 @@ These calculations or manipulations can use data types, classes, or functions of Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value. -#### Pre-commit plugin +#### Pre-commit Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style: @@ -95,9 +95,7 @@ python3 -m pip install pre-commit # only required the first time pre-commit install ``` -That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files: - -That's it! The plugin will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files: +That's it! Pre-commit will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files: ```bash pre-commit run --all-files --show-diff-on-failure @@ -130,8 +128,6 @@ We want your work to be readable by others; therefore, we encourage you to note ruff check ``` -- Original code submission require docstrings or comments to describe your work. - - Original code submissions require docstrings or comments to describe your work. - More on docstrings and comments: @@ -141,12 +137,12 @@ We want your work to be readable by others; therefore, we encourage you to note The following are considered to be bad and may be requested to be improved: ```python - x = x + 2 # increased by 2 + x += 2 # increased by 2 ``` - This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on, or below a line of code, as long as you are consistent within the same piece of code. + This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line). Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code." - We encourage you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example: + We require you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example: ```python def sum_ab(a, b): From 9ff9cfbf330cd57fcd331b0a283d77abf21cae66 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:10:58 +0000 Subject: [PATCH 09/11] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5df423840d96..cac56028d55f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -140,7 +140,7 @@ We want your work to be readable by others; therefore, we encourage you to note x += 2 # increased by 2 ``` - This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line). Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code." + This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line). Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code." We require you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example: From ee6ae8bd1dedfe0c95ee1aeef1035e45cdedceea Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 10 Sep 2026 15:13:04 +0200 Subject: [PATCH 10/11] Improve comments guidelines in CONTRIBUTING.md Reorganize comments on code explanation for clarity. --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cac56028d55f..351dbab23351 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -140,7 +140,8 @@ We want your work to be readable by others; therefore, we encourage you to note x += 2 # increased by 2 ``` - This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line). Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code." + This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line). +Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code." We require you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example: From 3a3fab89f255c831c7e6ff88bf1866c56b409dd4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 10 Sep 2026 15:31:01 +0200 Subject: [PATCH 11/11] Update forward propagation reference link --- neural_network/simple_neural_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neural_network/simple_neural_network.py b/neural_network/simple_neural_network.py index 8751a38908cf..1a58310b8876 100644 --- a/neural_network/simple_neural_network.py +++ b/neural_network/simple_neural_network.py @@ -1,6 +1,6 @@ """ Forward propagation explanation: -https://towardsdatascience.com/forward-propagation-in-neural-networks-simplified-math-and-code-version-bbcfef6f9250 +https://en.wikipedia.org/wiki/Feedforward_neural_network """ import math