Commit Graph

2966 Commits

Author SHA1 Message Date
Carlos Villar
7b521b66cf
Add Viterbi algorithm (#7509)
* Added Viterbi algorithm Fixes: #7465

Squashed commits

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

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

* Added doctest for validators

* moved all extracted functions to the main function

* Forgot a type hint

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-29 15:44:18 +02:00
Anshraj Shrivastava
efb4a3aee8
added algo for finding permutations of an array (#7614)
* Add files via upload

* Delete permutations.cpython-310.pyc

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

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

* Update permutations.py

* Update permutations.py

* Add files via upload

* Delete permutations.py

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

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

* Update permutations.py

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

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

* Update permutations.py

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

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

* Update permutations.py

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

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

* Update data_structures/arrays/permutations.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update permutations.py

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

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

* Update permutations.py

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

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

* Update data_structures/arrays/permutations.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update permutations.py

* Update permutations.py

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

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

* Update permutations.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-29 15:29:15 +02:00
JatinR05
93ad7db97f
Create recursive_approach_knapsack.py (#7587)
* Create recursive_approach_knapsack.py

Added a new naïve recursive approach to solve the knapsack problem.

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

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

* Update recursive_approach_knapsack.py

Updated the code

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

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

* Update recursive_approach_knapsack.py

Updated

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-29 15:28:12 +02:00
Andrey
584e743422
Fix yesqa hook (#7843)
* fix yesqa hook

* Remove redundant noqa

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 15:07:02 +02:00
Pronoy Mandal
18ffc4dec8
Update password_generator.py (#7745)
* Update password_generator.py

1. Use secrets module instead of random for passwords as it gives a secure source of randomness
2. Add type annotations for functions
3. Replace ctbi (variable for the characters to be included) with a more meaningful and short name
4. Use integer division instead of obtaining the integer part of a division computing a floating point

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-29 14:54:13 +02:00
tarushirastogi
b0f68a0248
Create centripetal_force.py (#7778)
* Create centripetal_force.py

Centripetal force is the force acting on an object in curvilinear motion directed towards the axis of rotation or centre of curvature.

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

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

* Update centripetal_force.py

The value error should also handle negative values of the radius and using more descriptive names will be more beneficial for the users

* Update centripetal_force.py

Made some bug fixes

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: SparshRastogi <75373475+SparshRastogi@users.noreply.github.com>
2022-10-29 14:43:51 +02:00
Sineth Sankalpa
327c38d6f0
Srilankan phone number validation (#7706)
* Add is_srilankan_phone_number.py

* Update is_srilankan_phone_number.py
2022-10-29 14:40:14 +02:00
Andrey
6e809a25e3
Rename files (#7819) 2022-10-29 14:31:56 +02:00
Andrey
a9bd68d96e
Add running doctest to pytest default (#7840)
* Add default options for pytest

* updating DIRECTORY.md

* Move pytest settings to pyproject.toml

* Move coverage settings to the pyproject.toml

* Return --doctest-continue-on-failure to pytest

* Convert pytest args to list

* Update pyproject.toml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-29 14:27:47 +02:00
SparshRastogi
301a520f03
Create potential_energy.py (#7666)
* Create potential_energy.py

Finding the gravitational potential energy of an object with reference to the earth, by taking its mass and height above the ground as input

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

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

* Update physics/potential_energy.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update physics/potential_energy.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update physics/potential_energy.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/potential_energy.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/potential_energy.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/potential_energy.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/potential_energy.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 00:14:44 +13:00
Andrey
cf08d9f5e7
Format docs (#7821)
* Reformat docs for odd_even_sort.py

* Fix docstring formatting

* Apply suggestions from code review

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-29 08:26:19 +02:00
Andrey
762afc086f
Update breadth_first_search_2.py (#7765)
* Cleanup the BFS

* Add both functions and timeit

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

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

* Add performace results as comment

* Update breadth_first_search_2.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-28 22:27:39 +02:00
Shubham Kondekar
fe5819c872
Create combination_sum_iv.py (#7672)
* Create combination_sum_iv.py

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

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

* Update dynamic_programming/combination_sum_iv.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/combination_sum_iv.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/combination_sum_iv.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

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

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

* Update combination_sum_iv.py

* Update combination_sum_iv.py

* Resolved PR Comments

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

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

* minor change, argument missing in function

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

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

* Update dynamic_programming/combination_sum_iv.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* minor change

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-28 21:32:32 +02:00
Pronoy Mandal
528b129019
Update maximum_subarray.py (#7757)
* Update maximum_subarray.py

1. Rectify documentation to indicate the correct output: function doesn't return the subarray, but rather returns a sum.
2. Make the function more Pythonic and optimal.
3. Make function annotation generic i.e. can accept any sequence.
4. Raise value error when the input sequence is empty.

* Update maximum_subarray.py

1. Use the conventions as mentioned in pep-0257.
2. Use negative infinity as the initial value for the current maximum and the answer.

* Update maximum_subarray.py

Avoid type conflict by returning the answer cast to an integer.

* Update other/maximum_subarray.py

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>

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

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

* Update maximum_subarray.py

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

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

* Update maximum_subarray.py

Remove typecast to int for the final answer

Co-authored-by: Andrey <Cjkjvfnby@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-28 21:08:41 +02:00
Andrey
d9efd7e25b
Update PR template (#7794)
* Update PR template

* Revert changes, reword line
2022-10-28 20:54:44 +02:00
SparshRastogi
26cecea271
Create fetch_amazon_product_data.py (#7585)
* Create fetch_amazon_product_data.py

This file provides a function which will take  
a product name as input from the user,and fetch the necessary  
information about that kind of products from Amazon like the product 
title,link to that product,price of the product,the ratings of 
the product and the discount available on the product  
in the form of a csv file,this will help the users by improving searchability  
and navigability and find the right product easily and in a short period of time, 
it will also be beneficial for performing better analysis on products

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

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

* Update fetch_amazon_product_data.py

Added type hints and modified files to pass precommit test

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

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

* Update fetch_amazon_product_data.py

Added type hints and made changes to pass the precommit

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

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

* Update fetch_amazon_product_data.py

Modified function to return the data in the form of Pandas Dataframe,modified type hints and added a functionality to let the user determine if they need the data in a csv file

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

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

* Update fetch_amazon_product_data.py

Made some bug fixes

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

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

* Update and rename fetch_amazon_product_data.py to get_amazon_product_data.py

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

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

* Update get_amazon_product_data.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-28 16:33:21 +02:00
Kuldeep Borkar
3a671b57a2
Implemented Swish Function (#7357)
* Implemented Swish Function

* Added more description and return hint in def

* Changed the name and added more descrition including test for sigmoid function

* Added * in front of links
2022-10-28 16:27:16 +02:00
Christian Clauss
19bff003aa
Adopt Python >= 3.8 assignment expressions using auto-walrus (#7737)
* Adopt Python >= 3.8 assignment expressions using auto-walrus

* updating DIRECTORY.md

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

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

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-28 15:54:54 +02:00
MoPaMo
15c93e5f4b
fix typo in caesar_cipher.py (#7761)
very character-> every character
2022-10-27 23:03:34 +02:00
Caeden Perelli-Harris
25757e697c
Binary tree path sum (#7748)
* feat: Implement binary tree path sum (#7135)

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

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

* Update data_structures/binary_tree/binary_tree_path_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Rename `dfs` to `depth_first_search`

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-27 23:03:01 +02:00
SwayamSahu
de3271ec80
Refactoring the syntax using list comprehension (#7749)
* Refactoring the syntax using list comprehension

* Update detecting_english_programmatically.py

* Update detecting_english_programmatically.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-27 23:02:15 +02:00
Caeden Perelli-Harris
61eedc16c3
Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation

* refactor: Remove useless `print` and `pass` statements

* revert: Replace broken doctests

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

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

* revert: Fix failing doctests

* chore: Satisfy pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:52:00 +02:00
Alexandre Velloso
501a1cf0c7
Remove unnecessary else statement (#7759)
* Remove unnecessary else statement

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:51:14 +02:00
Matteo Messmer
71e8ed81ae
Added spheres union (#6879)
* Spheres union

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

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

* Update volume.py

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

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

* Update volume.py

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

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

* f-strings

* Update maths/volume.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* more tests

* fix non negative

* fix 0 radius

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

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

* fix tests

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

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

* fix tests

* fix print

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

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

* fix comment

* fix comment

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

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

* Update volume.py

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-27 19:45:58 +02:00
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Caeden Perelli-Harris
e8915097c4
refactor: Fix matrix display deprecation (#7729) 2022-10-27 15:15:15 +02:00
SparshRastogi
e906a5149a
Create malus_law.py (#7710)
* Create malus_law.py

Finding the intensity of light transmitted through a polariser using Malus Law and by taking initial intensity and angle between polariser and axis as input

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

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

* Update physics/malus_law.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/malus_law.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/malus_law.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update physics/malus_law.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update malus_law.py

Made some changes in the error messages and the docstring testcases

* Update malus_law.py

Made changes for the passing the precommit

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-27 13:22:10 +02:00
Sushant Srivastav
d33f9b31fe
Calculate GST Amount (#7694)
* Calculate GST Amount

The program helps to get the net amount after GST is added to it.

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

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

* Update financial/calculating GST.py

Thanks!

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update and rename calculating GST.py to price_plus_tax.py

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

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

* Update price_plus_tax.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-26 23:15:02 +02:00
SwayamSahu
71c7c0bd35
Updated a typo in print statement (#7696)
* Updated a typo in print statement

* Apply suggestions from code review

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-26 22:20:00 +02:00
Arjit Arora
b46b92a916
Add function for highest set bit location (#7586)
* Add function for highest set bit location

* Address review comments
2022-10-26 22:09:23 +02:00
Christian Clauss
74325d079c
Rename quantum_random.py to quantum_random.py.DISABLED.txt (#7683)
* Rename quantum_random.py to quantum_random.py.DISABLED.txt

#7682

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-26 22:08:53 +02:00
Shubham Kondekar
614274a9dc
Update spiral_print.py (#7674)
* Update spiral_print.py

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

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

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/spiral_print.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

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

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

* Update spiral_print.py

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

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

* Update spiral_print.py

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

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

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

* Update spiral_print.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-26 18:58:33 +02:00
Shubham Kondekar
5c8a939c5a
Create largest_square_area_in_matrix.py (#7673)
* Create largest_square_area_in_matrix.py

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

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

* Update matrix/largest_square_area_in_matrix.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update matrix/largest_square_area_in_matrix.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

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

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

* Update largest_square_area_in_matrix.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-26 17:06:15 +02:00
JatinR05
8fd06efe22
Create minimums_squares_to_represent_a_number.py (#7595)
* Create minimums_squares_to_represent_a_number.py

added a dynamic programming approach of finding the minimum number of square to represent a number.
eg : 
25 = 5*5
37 = 6*6 + 1*1
21 = 4*4 + 2*2 + 1*1

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

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

* Update and rename minimums_squares_to_represent_a_number.py to minimum_squares_to_represent_a_number.py

updated the code

* Update minimum_squares_to_represent_a_number.py

I have added the appropriate checks for 0 and 12.34. 
It would be great if you could suggest a name for the dp array

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

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

* Update minimum_squares_to_represent_a_number.py

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

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

* Update minimum_squares_to_represent_a_number.py

updated

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

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

* Update minimum_squares_to_represent_a_number.py

updated

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-26 16:43:01 +02:00
Karthik Ayangar
9390565350
added support for inverse of 3x3 matrix (#7355)
* added support for inverse of 3x3 matrix

* Modified Docstring and improved code

* fixed an error

* Modified docstring

* Apply all suggestions from code review

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-26 10:36:40 +02:00
CenTdemeern1
abf0909b68
Write a proper implementation for base16 (#6909)
According to CONTRIBUTING.md:
"Algorithms in this repo should not be how-to examples for existing Python packages."
2022-10-26 19:09:28 +13:00
M3talM0nk3y
68f6e9ac30
Added function that checks if a string is an isogram (#7608)
* Added function that checks if a string is an isogram.

* Added wiki reference and fixed comments.

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

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

* Made function name more self-documenting. Raise ValueError if string contains 1 or more digits. Renamed file. Lowercase string inside function.

* Removed check_isogram.py (file renamed).

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

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

* Fixed test failure.

* Raise ValueError when string has non-alpha characters. Removed import.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-26 16:31:16 +13:00
Mislah
505c5e20fa
Included area of n sided regular polygon (#7438)
* Included area of n sided regular polygon 

Added a function to calculate the area of n sided regular polygons

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

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

* code standard fixes as per PR comments

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

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-26 00:26:05 +02:00
RohitSingh107
c31ef5e778
Add longest common substring (#7488)
* added longest common substring

* added retrun type hint

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* changed t1, t2 to text1, text2

* Update longest_common_substring.py

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

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

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

* applied suggested changes

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* removed space between line

* return longest common substring

* Update dynamic_programming/longest_common_substring.py

Co-authored-by: Christian Clauss <cclauss@me.com>

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

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

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-25 22:55:48 +01:00
Karthik Ayangar
c3bcfbf19d
Add Cramer's rule for solving system of linear equations in two variables (#7547)
* added script for solving system of linear equations in two variables

* implemented all the suggested changes

* changed RuntimeError to ValueError

* Update matrix/system_of_linear_equation_in_2_variables.py

* Update matrix/system_of_linear_equation_in_2_variables.py

* Update and rename system_of_linear_equation_in_2_variables.py to cramers_rule_2x2.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-25 22:55:31 +01:00
harshyadavcs
2c959a7491
Update documentation of cnn_classification.py (#7486)
* Updated documentation of cnn_classification.py for much better understanding

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

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

* Update computer_vision/cnn_classification.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-25 22:43:45 +01:00
Arya Samik
7e3dff17c5
Docs: correct the shape of trajectory (#6255)
The shape of the trajectory of projectile is a parabola.
2022-10-25 22:42:49 +01:00
Tianyi Zheng
d25187eb7f
Remove type cast in combinations algorithm (#7607)
* Remove commented-out print statements in algorithmic functions

* Encapsulate non-algorithmic code in __main__

* Remove unused print_matrix function

* Remove print statement in __init__

* Remove print statement from doctest

* Encapsulate non-algorithmic code in __main__

* Modify algorithm to return instead of print

* Encapsulate non-algorithmic code in __main__

* Refactor data_safety_checker to return instead of print

* updating DIRECTORY.md

* updating DIRECTORY.md

* Apply suggestions from code review

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

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

* updating DIRECTORY.md

* Remove int cast and change float division to int division

* Move new-line chars

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-25 22:34:46 +02:00
Karthik S
103c9e0876
Added Implementation of NAND, OR ,XNOR and NOT gates in python (#7596)
* Added Implementation for XNOR gate

* Added Implementation for OR gate

* Added implementation of NAND gate

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

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

* Added Implementation of NAND gate

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

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

* Updated nand_gate.py

* updated xnor_gate.py after some changes

* Delete due to duplicate file

* Updated xnor_gate.py

* Added Implementation of NOT gate in python

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

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

* fixed a typo error

* Updated to a new logic

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

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

* Updated nand_gate.py file

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-25 21:53:21 +02:00
Havish
450842321d
Arc Length Algorithm (#7610)
* Create decimal_conversions.py

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

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

* Create arc_length.py

* Delete decimal_conversions.py

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

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

* Removed redundant statement, fixed line overflow

* Update arc_length.py

Changed rad to radius as not to get confused with radians

* Update arc_length.py

* Update arc_length.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-25 21:47:52 +02:00
SparshRastogi
cbdbe07ffd
Create kinetic_energy.py (#7620)
* Create kinetic_energy.py

Finding the kinetic energy of an object,by taking its mass and velocity as input

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

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

* Update kinetic_energy.py

* Update kinetic_energy.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-25 21:43:02 +02:00
Arjit Arora
a662d96196
Add function for xor gate (#7588)
* Add function for xor gate

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

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

* Add test case for xor functions

* Update boolean_algebra/xor_gate.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update boolean_algebra/xor_gate.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Split long comment line into two lines

* 88 characters per line

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-25 21:26:53 +02:00
Maxim Smolskiy
d407476531
fix: increase str conversion limit where required (#7604)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-25 06:27:03 +05:30
Maxim Smolskiy
a041b64f7a
feat: add Project Euler problem 073 solution 1 (#6273)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-24 18:59:49 +05:30
Carlos Villar
d8ab8a0a0e
Add Spain National ID validator (#7574) (#7575)
* Add Spain National ID validator (#7574)

* is_spain_national_id()

* Update is_spain_national_id.py

* Some systems add a dash

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-24 13:33:56 +02:00