Commit Graph

2703 Commits

Author SHA1 Message Date
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
JatinR05
bb078541dd
Update count_number_of_one_bits.py (#7589)
* Update count_number_of_one_bits.py

removed the modulo operator as it is very time consuming in comparison to the and operator

* Update count_number_of_one_bits.py

Updated with the timeit library to compare. Moreover I have updated my code which helps us in reaching the output comparatively faster.

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

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

* Update bit_manipulation/count_number_of_one_bits.py

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

* Update count_number_of_one_bits.py

Updated the code

* Update count_number_of_one_bits.py

Updated code

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

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

* Run the tests before running the benchmarks

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

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

* consistently

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-24 12:13:39 +02:00
Arjit Arora
bd490614a6
Add function for AND gate (#7593) 2022-10-24 12:13:01 +02:00
Nadirhan Şahin
e2a83b3bc6
Update knapsack.py (#7271)
* Update knapsack.py

* Update dynamic_programming/knapsack.py

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

* Update knapsack.py

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

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

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-23 21:28:11 +02:00
Laukik Chahande
39a99b46f5
check whether integer is even or odd using bit manupulation (#7099)
* even_or_not file added

* Updated DIRECTORY.md

* modified DIRECTORY.md

* Update bit_manipulation/even_or_not.py

* updating DIRECTORY.md

* Rename even_or_not.py to is_even.py

* updating DIRECTORY.md

Co-authored-by: luciferx48 <laukik.22010776@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-23 19:26:22 +02:00
Christian Clauss
b8b63469ef
My favorite palindrome (#7455)
* My favorite palindrome

* updating DIRECTORY.md

* Update is_palindrome.py

* Update is_palindrome.py

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

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

* Update strings/is_palindrome.py

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

* Update is_palindrome.py

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>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-23 18:12:49 +02:00
SwayamSahu
0dc95c0a6b
Update comments in check_pangram.py script (#7564)
* Update comments in check_pangram.py script

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

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

* Update and rename check_pangram.py to is_pangram.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-23 18:00:59 +02:00
Caeden Perelli-Harris
10b6e7a658
fix: Fix line too long in doctest (#7566) 2022-10-23 17:14:45 +02:00
Caeden Perelli-Harris
393b960525
refactor: Replace doctest traceback with ... (#7558) 2022-10-23 16:36:10 +02:00
Sagar Giri
0f06a0b5ff
Add web program to fetch top 10 real time billionaires using the forbes API. (#7538)
* Add web program to fetch top 10 realtime billioners using forbes API.

* Provide return type to function.

* Use rich for tables and minor refactors.

* Fix tiny typo.

* Add the top {LIMIT} in rich table title.

* Update web_programming/get_top_billioners.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

* Change the API path.

* Update get_top_billioners.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: Christian Clauss <cclauss@me.com>
2022-10-23 16:35:27 +02:00
Christian Clauss
81ccf54c75
Rename xgboostclassifier.py to xgboost_classifier.py (#7550)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-23 18:39:25 +05:30
Caeden Perelli-Harris
d5f322f576
fix: Replace deprecated qasm_simulator with aer_simulator (#7308) (#7556) 2022-10-23 18:36:12 +05:30
Kevin Joven
a5362799a5
Create superdense_coding.py (#7349)
* Create superdense_coding.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>
2022-10-23 18:24:27 +05:30
Pradyumn Singh Rahar
a3383ce3fd
Reduced Time Complexity to O(sqrt(n)) (#7429)
* Reduced Time Complexity to O(sqrt(n))

* Added testmod

* [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-23 17:56:40 +05:30