Commit Graph

267 Commits

Author SHA1 Message Date
Lewis Tian
77b243e62b
bugfix: Add empty list detection for find_max/min (#4881)
* bugfix: Add empty list detection for find_max/min

* fix shebangs check
2021-10-07 23:20:32 +08:00
Lewis Tian
a4d68d69f1
bugfix: Add abs_max.py & abs_min.py empty list detection (#4844)
* bugfix: Add abs_max.py & abs_min.py empty list detection

* fix shebangs check
2021-10-06 22:06:49 +08:00
Arghya Sarkar (ASRA)
b9f18152b7
Create check_polygon.py (#4605)
* Create check_polygon.py

* Update check_polygon.py

* Update maths/check_polygon.py

* Update check_polygon.py

* Update check_polygon.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-09-30 00:49:42 +08:00
Christian Clauss
dc07a85076
Update and rename check_valid_ip_address.py to is_ip_v4_address_valid.py (#4665)
* Update and rename check_valid_ip_address.py to is_ip_v4_address_valid.py

New test cases that the algorithm must detect:
* [ ] an octet much bigger than 255
* [ ] an octet is negative
* [ ] number of octets is less than 4
* [ ] number of octets is greater than 4
* [ ] an octet is a letter

* updating DIRECTORY.md

* Add two more tests to is_ip_v4_address_valid.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-09-23 02:03:11 +08:00
jonabtc
4761fef1a5
Double factorial iterative (#4760)
* Adding the double factorial algorithm

* Adding the double factorial algorithm

Co-authored-by: Jonathan Ocles <jocles@chiang.ec>
2021-09-19 03:22:47 +02:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
Aviv Faraj
5d5831bdd0
Physics new code (#4709)
* added gamma_function

* Add files via upload

* Resolved issue with str.format

And also changed output to math notation

* Update gamma_function.py

* Rename physics/gamma_function.py to maths/gamma_recursive.py

* Fixes: #4709 Fixed issues for pre-commit test

* Fixes: #4709 solved issues with doctests

And comments

* Fixes: #4709 Added failed tests to doctest

* Align with Python's Standard Library math.gamma()

Replicate the exceptions of https://docs.python.org/3/library/math.html#math.gamma

* Update gamma_recursive.py

* Update gamma_recursive.py

* Update gamma_recursive.py

* Update gamma_recursive.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-09-06 23:57:18 +02:00
Christian Clauss
097f830238
Avoid mutable default arguments (#4691) 2021-08-31 06:56:15 +02:00
imp
af0810fca1
[mypy] Fix type annotations for maths (#4617)
* Fix mypy errors for armstrong_numbers.py

* Fix mypy errors for harmonic_series.py

* Fix mypy errors for average_median.py
2021-08-18 12:45:07 +02:00
imp
d009cea391
Fix mypy error at maths (#4613)
* Fix mypy errors for maths/greedy_coin_change.py

* Fix mypy errors for maths/two_sum.py

* Fix mypy errors for maths/triplet_sum.py

* Fix the format of maths/greedy_coin_change.py

* Fix the format of maths/greedy_coin_change.py

* Fix format with pre-commit
2021-08-15 21:15:53 +02:00
Shubham Ganar
63ac09eeae
Created check_valid_ip_address.py (#4602)
* Created check_valid_ip_address.py

* fixed typos error

Co-authored-by: root <root@localhost.localdomain>
2021-08-08 20:21:26 +02:00
jonabtc
5957eabd3e
Adding the double factorial algorithm (#4550) 2021-08-03 08:03:22 +02:00
Grigoriy Hanin
4f9ee4330a
basic_maths input check (#4486)
* Prime factor input check

* number_of_divisors input check

* sum_of_divisors input check
2021-06-16 08:34:32 +02:00
Grigoriy Hanin
7d19d54f6f
Average mean refactor (#4485)
* Average mean refactor

Added doctests and type hints to average_mean

* Wiki link added

* Empty list check added

Empty list check added
Type hint changed to typing.List
2021-06-16 08:33:23 +02:00
Grigoriy Hanin
0eabdb54b1
Average median type hint (#4483)
* Update average_median.py

* Wikipediad link added
2021-06-14 22:39:51 +02:00
Anderson Torres
f37d415227
Add new algorithm for Armstrong numbers (#4474)
* Add a new algorithm for Armstrong numbers

* FAILING = (-153, -1, 0, 1.2, 200, "A", [], {}, None)

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-06-04 22:28:26 +02:00
Grigoriy Hanin
40e357f688
Mistake in maths/average_mode.py fixed. (#4464)
A serious bug was addressed with this pull request. The mode function previously
didn't return the mode of the input list. Instead, it always returned the first value.
Due to lacking tests, the bug was never caught. This pull request also adds new
functionality to the function, allowing support for more than one mode.

See #4464 for details.

* * Mistake in average_mode.py fixed. The previous solution was to returnthe
value on the first loop iteration, which is not correct, more than that it
used to delete repeating values, so result's array and check array lost
relation between each other

* Type hint added

* redundant check_list deleted

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Suggestions resolved

* output typing changed to Any
* test cases added

* Black done

File formatted

* Unused statistics import

statistics only used in doctest, now they are imported in doctest

* Several modes support added

Several modes support added

* Comment fix

* Update maths/average_mode.py

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>

* Suggestions added

Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
2021-06-04 15:16:32 -05:00
Grigoriy Hanin
b3b89d9460
Armstrong number definition fix (#4466)
This is a documentation fix. This fix patches a mistake in the description of the Armstrong number.

* * Doc fix

* Armstrong number is not the sum of cube's of number digits, but
the sum of number's digits each raised to the power of the number of digits

* Update armstrong_numbers.py

Line shorten
2021-05-30 18:41:07 -05:00
Dhruv Manilawala
6f21f76696
fix(ci): Update pre-commit hooks and apply new black (#4359)
* fix(ci): Update pre-commit hooks and apply new black

* remove empty docstring
2021-04-26 07:46:50 +02:00
Elisha Hollander
806b3864c3
refactor: Remove default value of exponential_term (#4308)
exponential_term doesn't need a default value
2021-04-04 09:32:36 +05:30
algobytewise
8d51c2cfd9
move-files-and-2-renames (#4285) 2021-03-22 10:52:26 +01:00
DevanshiPatel18
dd757dce38
feat: Add greedy_coin_change.py algorithm (#3805)
* Hacktoberfest: Add greedy_coin_change.py file 

added the file in greedy_methods folder to implement the same method

Altered the code according to the changes that were requested.

* Added doctests.

doctests added to the function find_minimum_change.

* Added Greedy change file in Maths folder.

* updating DIRECTORY.md

* Deleted Greedy Method Folder

* updating DIRECTORY.md

* Update greedy_coin_change.py

* fix: black formatting issues

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2021-03-20 11:48:38 +05:30
algobytewise
2dc2c99f2b
refactor: Rename explicit_euler.py to euler_method.py (#4275)
* reupload

* Rename explicit_euler.py to euler_method.py

* Delete file
2021-03-20 11:41:10 +05:30
Christian Clauss
987567360e
Update our pre-commit dependencies (#4273)
* .pre-commit-config.yaml: mypy directories that pass

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-03-20 10:42:17 +05:30
Ayush Bisht
ced83bed2c
Add arithmetic_mean.py (#4243)
* arithmetic_mean

* arithmetic_mean

* checks

* checked

* Revert "checked"

This reverts commit 3913a39ae2.

* checks-3

* update-1
2021-03-12 08:25:54 +01:00
Ayush Bisht
0435128cc0
Add geometric_mean.py (#4244)
* geometric_mean3

* update-GM.PY

* update-AM.PY

* Revert "update-AM.PY"

This reverts commit 11792ec974.
2021-03-01 22:30:16 +01:00
CarsonHam
61f3119467
Change occurrences of str.format to f-strings (#4118)
* f-string update rsa_cipher.py

* f-string update rsa_key_generator.py

* f-string update burrows_wheeler.py

* f-string update non_recursive_segment_tree.py

* f-string update red_black_tree.py

* f-string update deque_doubly.py

* f-string update climbing_stairs.py

* f-string update iterating_through_submasks.py

* f-string update knn_sklearn.py

* f-string update 3n_plus_1.py

* f-string update quadratic_equations_complex_numbers.py

* f-string update nth_fibonacci_using_matrix_exponentiation.py

* f-string update sherman_morrison.py

* f-string update levenshtein_distance.py

* fix lines that were too long
2021-02-23 11:23:49 +05:30
SiddhantJain15
dd4b265680
Add function to calculate area of triangle using Heron's formula (#4065)
* Update area.py

Modified area of triangle function. Added a new algorithm to calculate area when 3 sides are known

* Add files via upload

* Update area.py

* Update area.py

* Update area.py

* Update area.py

* Remove unnecessary whitespace

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-12-28 13:36:57 +05:30
Du Yuanchao
bfb0c3533d
Fixed LGTM and typehint (#3970)
* fixed LGTM
fixed typehint

* updating DIRECTORY.md

* Update lucas_series.py

* Update lucas_series.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-11-28 22:42:30 +08:00
Andrew
10427f8395
Create euclidean_distance.py (#3350)
* Create distance_formula.py

* Remove whitespace

* Update distance_formula.py

* Update distance_formula.py

* Update distance_formula.py

* Generalize

* Grammar mistake

* Rename distance_formula.py to euclidean_distance.py

* Update euclidean_distance.py

* v1 - > v2

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

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

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update euclidean_distance.py

* Update maths/euclidean_distance.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-27 15:48:20 +01:00
Joyce
03e7f37329
[mypy] math/sieve_of_eratosthenes: Add type hints (#2627)
* add type hints to math/sieve
* add doctest
* math/sieve: remove manual doctest
* add check for negative
* Update maths/sieve_of_eratosthenes.py
* Update sieve_of_eratosthenes.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-23 11:07:42 +05:30
김수연
8a134e1f45
update area.py (#3862)
add method "area_ellipse"
- Calculate the area of a ellipse

Co-authored-by: 201502029 <tnehd158@naver.com>
2020-11-18 18:35:51 +08:00
sukyung99
78a0f61b19
Add Maths / Sigmoid Function (#3880)
* Add Maths / Sigmoid Function

* Update Sigmoid Function

* Add doctest and type hints

* Fix Trim Trailing Whitespace

* Fix Error

* Modified Black

* Update sigmoid.py

Co-authored-by: sukyung99 <tnrudsla413@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-11-15 09:14:40 +05:30
Jake Gerber
a538989939
Added decimal_isolate.py (#3700)
* Add files via upload

* Delete decimal_isolate.py

* Added decimal_isolate file.

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Delete decimal_isolate.py

* Add files via upload

* Update maths/decimal_isolate.py

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

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

* Update decimal_isolate.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-30 23:10:44 +01:00
Joyce
a6831c898a
math/greatest_common_divisor: add support for negative numbers (#2628)
* add type hints to math/gcd

* add doctest

* math/gcd - run black formatter

* math/gcd: remove manual doctest

* add correction to gcd of negative numbers

* add more doctest in iterative gcd
2020-10-29 12:47:26 +05:30
Rolv Apneseth
8f81c460fe
Made improvements to combinations.py (#3681)
* Made improvements to combinations.py

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

* Function now raises an error when given invalid input

* Update maths/combinations.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-10-26 14:48:06 +08:00
Kushagra Bansal
b93a9d8e8f
Update lucas_series.py to include another method (#3620)
* Update lucas_series.py

Added another method to calculate lucas_numbers

* Fix pre-commit error

* Update lucas_series.py

* Update lucas_series.py

* Update lucas_series.py

* Update lucas_series.py
2020-10-26 09:37:11 +05:30
Du Yuanchao
81b82bea47
Update ceil and floor function (#3710)
* Update ceil and floor function

* add end line

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-26 00:02:24 +08:00
Rolv Apneseth
04fae4db9b
Improved and shortened prime_check.py (#3454)
* Made small improvements and shortened prime_check.py

* improved descriptions on tests in prime_check.py

* Ran black and isort
2020-10-24 00:17:29 +08:00
Christian Clauss
9b95e4f662
Pyupgrade to python3.8 (#3616)
* Upgrade to Python 3.8 syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-21 12:46:14 +02:00
Joyce
e41d04112f
Fixes: #2630 Add doctests and support for negative numbers (#2626)
* add type hints to math/extended euclid

* math/extended euclid - add doctest

* math/extended euclid: remove manual doctest

* change algorithm for negative numbers

* improve naming of variables

* Update extended_euclidean_algorithm.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>
2020-10-07 15:23:14 +05:30
Du Yuanchao
437c725e64
Fixed allocation_number (#2768)
* fixed allocation_number

* fixed pre-commit

* fixed line too long

* fixed bug
2020-10-05 09:17:46 +05:30
Sabari Ganesh
fb9b9ecccf
Update area.py (#2524)
* Update area.py

Added Area for Rhombhus

* Update area.py

Added rhombhus area. And fixed some gaps error.

* Update area.py

Added Rhombhus area.

* Update area.py

Fixed suggested changes
2020-10-04 22:20:47 +08:00
Dhruv
acaeb22bbd
Add GitHub action for pre-commit (#2515)
* Add GitHub action file for pre-commit

* Fix errors exposed by pre-commit hook:

- Remove executable bit from files without shebang. I checked those
  file and it was not needed.
- Fix with black

* Apply suggestions from code review

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-30 15:23:34 +02:00
Dhruv
0a42ae9095
Fix all errors mentioned in pre-commit run (#2512)
* Fix all errors mentioned in pre-commit run:

- Fix end of file
- Remove trailing whitespace
- Fix files with black
- Fix imports with isort

* Fix errors
2020-09-30 10:38:00 +02:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Lewis Tian
121dddc7f2
Update maths/area.py (#2501)
the parameters of geometric shapes should be non-negative values
2020-09-28 22:40:47 +08:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Hasenn
20e98fcded
Fix some warnings from LGTM (#2420)
* fix assignment of a variable to itself

* Fix unnecessary 'else' clause in loop

* formatting and redundant reasignment fix

* mark unreachable code with a TODO comment

* fix variable defined multiple times

* fix static method without static decorator

* revert unintended autoformatting

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

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 10:11:27 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
Björn Olsson Jarl
8c191f1fc9
Added type hints for maths/fibonacci_sequence_recursion. (#2372) 2020-08-30 10:51:45 +02:00
Björn Olsson Jarl
ab5a046581
Added type hints and doctest for maths/prime_check. (#2367)
* Added type hints and doctest for maths/prime_check.

* Removed doctests.
2020-08-29 17:11:02 +02:00
Kushagra Bansal
f2f0425357
Created ugly_numbers.py in Python/maths (#2366)
* Add files via upload

* Update ugly_numbers.py

* Update ugly_numbers.py

* Update ugly_numbers.py
2020-08-29 16:57:34 +02:00
Iheb Haboubi
2c0127d71a
Perfect square using binary search (#2351)
* Add perfect_square_binary_search

* Update tests

* Add tests
2020-08-25 21:26:11 +02:00
Du Yuanchao
0591968947
Optimization and fix bug (#2342)
* * optimization aliquot_sum
* fix bug in average_median

* fixup! Format Python code with psf/black push

* Update maths/average_median.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-21 14:39:03 +08:00
Du Yuanchao
34294b5641
Update sum_of_digits.py (#2319)
* * support negative number
* add different version

* fixup! Format Python code with psf/black push

* sum(int(c) for c in str(abs(n)))

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-16 20:31:06 +02:00
Du Yuanchao
d687030d9e
fix number_of_digits bug (#2301)
* fix bug

* test larger negative

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-12 18:32:35 +02:00
Filip Hlasek
871f8f4e00
More efficient least common multiple. (#2281)
* More efficient least common multiple.

* lowest -> least

* integer division

* Update least_common_multiple.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-05 12:39:15 +02:00
Christian Clauss
4535283554
Re-blacken (#2246)
* Avoid double spaces

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-01 09:23:23 +05:30
aryan26roy
373f193c6d
Correcting the Gaussian Formula (#2249)
* Correcting the Gaussian Formula

I have added the parenthesis around the 2*sigma^2 term.

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

* Update gaussian.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 21:32:36 +02:00
Utsav Akash Naskar
c7a5f1673e
Python Program to Check Krishnamurthy Number (#2248)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

* Added Python Program to Check Krishnamurthy Number or not

* Added Python Program to Check Krishnamurthy Number

* Added Python Program to Check Krishnamurthy Number or not

* Build Error Fix - 1

* Build Error Fix - 2

* Fix Brackets positions

* Fix Character Exceeding Error

* Made Review Changes

* Build Error Fix - 3

* Build Error Fix - 4

* Update krishnamurthy_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-29 10:54:05 +02:00
Utsav Akash Naskar
9ea144f3bd
Added Python Program to Check Perfect Number (#2244)
* Added Python Program to Check Perfet Number

* CodeSpell Error Fix - 1

* Build Error Fix - 1

* Made suggested changes

* Use generator expression

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-28 09:59:44 +02:00
lance-pyles
093a56e3c2
Remove function overhead in area (#2233)
* remove function overhead
add type hints

* remove unused import
2020-07-27 21:29:31 +08:00
Utsav Akash Naskar
dfb4ce4074
Added Finding Exponent Program (#2238)
* Finding Exponent Program

* Build Error Fix - 1

* Build Error Fix - 2

* Error Fix - 1 datatype

* self-documenting naming convension added

* Update and rename exponent_recursion.py to power_using_recursion.py

* Fix typo

* Fix typo

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-27 11:33:13 +02:00
Vasu Gamdha
e296f7b3ff
Updated maths/number_of_digits.py (#2221)
* Updated number_of_digits.py

Added two more methods!

* Update number_of_digits.py

* Update number_of_digits.py

* Added benchmarks!

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py

* Update number_of_digits.py
2020-07-26 12:42:18 +02:00
lance-pyles
b3950035a6
update variable names for consistency using standard formula terms; (#2223)
* update variable names for consistency using standard formula terms;

fix flake8 syntax errors;

fix doctests;

* tweak to variable name
2020-07-23 00:49:34 +02:00
XxSamixX123
749ffd8c6f
Added a binomial distribution formula calculator algorithm (#2197)
* Add files via upload

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

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

* Update binomial_distribution.py

* Update maths/binomial_distribution.py

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

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

* Update binomial_distribution.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-13 22:18:37 +02:00
Advik Kulkarni
6c2c08c076
sum_of_geometric_progression (#2168)
* Add files via upload

* Rename sum_of_Geometric_Progression.py to sum_of_geometric_progression.py

* Update sum_of_geometric_progression.py

* Update maths/sum_of_geometric_progression.py

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

* Update maths/sum_of_geometric_progression.py

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

* Update maths/sum_of_geometric_progression.py

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

* Update sum_of_geometric_progression.py

* Update sum_of_geometric_progression.py

* Type hints and test for zeros and negative numbers

* Update sum_of_geometric_progression.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-07-10 14:56:43 +02:00
lance-pyles
48df91d48b
Add surface area class (#2183)
* add surface area class

* add new line to end of file

* move surface area class into area class

* add missing import

* added pi import

* fix typo

* added blank line

* fixed more import issues

* comment fix

* comment fixes
2020-07-07 00:21:59 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Christian Clauss
f97af65579
Blacken our code (#2125)
* Blacken

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-17 06:59:38 +08:00
beqakd
924ef9b7d8
implementation of entropy algorithm. (#2110)
* implementation of entropy algorithm.

* add tests, fix requested changes

* open_file() --> analyze_text()

* Create bidirectional_breadth_first_search.py

* # type: ignore

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-16 21:36:57 +02:00
Christian Clauss
b9e5259aeb
Fix long line, tests (#2123)
* Fix long line

* updating DIRECTORY.md

* Add doctest

* ...

* ...

* Update tabu_search.py

* space

* Fix doctest

    >>> find_neighborhood(['a','c','b','d','e','a'])  # doctest: +NORMALIZE_WHITESPACE
    [['a','e','b','d','c','a',90], [['a','c','d','b','e','a',90],
     ['a','d','b','c','e','a',93], ['a','c','b','e','d','a',102],
     ['a','c','e','d','b','a',113], ['a','b','c','d','e','a',93]]

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-06-16 14:29:13 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
Vignesh
3893ed30ca
created perfect_cube.py (#2076)
* created perfect_cube.py

To find whether a number is a perfect cube or not.

* Update perfect_cube.py

* Update perfect_cube.py

* Update perfect_cube.py
2020-06-11 19:36:53 +02:00
Jeffin Francis
7a14285cb6
Harris corner detection (#2064)
* Added Lstm example for stock predection

* Changes after review

* changes after build failed

* Add Kiera’s to requirements.txt

* requirements.txt: Add keras and tensorflow

* psf/black

* haris corner detection

* fixup! Format Python code with psf/black push

* changes after review

* changes after review

* fixup! Format Python code with psf/black push

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-04 16:02:51 +02:00
Vignesh
0904610a76
create sum_of_digits.py (#2065)
* create sum_of_digits.py

create sum_of_digits.py to find the sum of digits of a number
digit_sum(12345) ---> 15
digit_sum(12345) ---> 10

* Update sum_of_digits.py

* Update maths/sum_of_digits.py

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

* Update maths/sum_of_digits.py

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

* Update sum_of_digits.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-02 23:38:32 +02:00
Vignesh
dc720a83d7
Create number_of_digits.py (#1975)
* Create number_of_digits.py

A python program to find the number of digits in a number.

* Update number_of_digits.py

* Update number_of_digits.py

* Add #1976 to get Travis CI to pass

#1976

* Add type hints as discussed in CONTRIBUTING.md

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-01 17:23:15 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Christian Clauss
1c62bd10c1
Precision must be a nonnegative integer (#2013)
* Precision must be a nonnegative integer

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-19 15:46:20 +05:30
Adityanagraj
e6fdcc90fd
consists of area of various geometrical shapes (#2002)
* consists of area of various geometrical shapes

In this program it consists of various area calculation of different geometrical shapes such as (square,rectangle) and many other shapes.

* print(f'Rectangle: {area_rectangle(10, 20)=}')

* Update area.py

* Areas of various geometric shapes:

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-18 23:06:19 +02:00
Kenneth P
77f3888b71
Pi digit extraction algorithm (#1996)
* added pi digit extraction formula

* updating DIRECTORY.md

* fixed typo in a comment

* updated bbp_formula.py

* Update maths/bbp_formula.py

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

* Update maths/bbp_formula.py

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

* Update bbp_formula.py

* Update and rename bbp_formula.py to bailey_borwein_plouffe.py

* updating DIRECTORY.md

* calculate

* "".join(bailey_borwein_plouffe(i) for i in range(1, 12))

* Update bailey_borwein_plouffe.py

* Update bailey_borwein_plouffe.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-18 22:54:08 +02:00
Christian Clauss
565060aa99
actions/setup-python@v2 (#1986)
* actions/setup-python@v2

* fixup! Format Python code with psf/black push

* Update autoblack.yml

* updating DIRECTORY.md

* Update codespell.yml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-16 08:49:56 +02:00
Kenneth P
a29a2a3a06
Added file aliquot_sum.py (#1985)
* Added file aliquot_sum.py containing a function to find theo

* Added parameter type info to aliquot_sum.py

* Update maths/aliquot_sum.py

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

* Update maths/aliquot_sum.py

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

* Updated code to raise ValueErrors if input is bad

* Fixed logical operators

* Removed unnecessary import

* Updated aliquot_sum.py

* fixed formatting

* fixed documentation

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-15 08:06:51 +02:00
Steven Qu
c8fbdee229
improved prime number generator to check only up to sqrt(n) instead of n (#1984)
* improved prime number generator to check only up to sqrt(n) instead of n

* added old version as slow_primes() and named new, faster version primes()

* fixed docstring in slow_primes

* Add a timeit benchmark

* Update prime_numbers.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-15 00:33:50 +02:00
Christian Clauss
a7cd633bb6
Fix astar (#1966)
* Fix astar

Single character variable names are old school.

* fixup! Format Python code with psf/black push

* Tuple

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-10 20:49:40 +05:30
Raj-Parekh24
eef6393935
Kadanes_algorithm (#1959)
* Add files via upload

* Update Kadane's_algorithm.py

* Update and rename Kadane's_algorithm.py to kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

* Update kadanes_algorithm.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-09 21:00:59 +02:00
Christian Clauss
08c8bb5ad5
Deal with maps (#1945)
* Deal with maps

Try with the search term "pizza" to see why this was done in #1932

* fixup! Format Python code with psf/black push

* Update armstrong_numbers.py

* updating DIRECTORY.md

* Update crawl_google_results.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-06 03:32:40 +02:00
Akash
f80ffe1f54
added method for checking armstrong number (#1936)
* added method for checking armstrong number

* Update comment

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-03 19:56:33 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
Christian Clauss
f6ee518ee1
Rename math/add.py to maths/add.py (#1857)
* Rename math/add.py to maths/add.py

* fixup! Format Python code with psf/black push

* Fix sum to add

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-04-13 07:50:46 +02:00
Christian Clauss
f17e9822b0
psf/black changes to next_greater_element.py (#1817)
* psf/black changes to next_greater_element.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-28 07:24:59 +01:00
wind-Lv
ac664df6a0
'allocation_content_length' (#1808)
* 'allocation_content_length'

* 'allocation_number'

* Delete allocation_content_length.py

* Update allocation_number.py

* Update allocation_number.py

* number_of_bytes and partitions

* Update allocation_number.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-20 15:24:05 +01:00
Christian Clauss
ab3400bfad
Travis CI: Fix Travis linter errors (#1802)
* Travis CI: Fix Travis linter errors

* fixup! Format Python code with psf/black push

* Update .travis.yml

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-03-14 23:55:13 +01:00
cschuerc
1bc84e1fa0
Add Monte Carlo estimation of PI (#1712)
* Add Monte Carlo estimation of PI

* Add type annotations for Monte Carlo estimation of PI

* Compare the PI estimate to PI from the math lib

* accuracy -> error

* Update pi_monte_carlo_estimation.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-14 07:51:30 +01:00
yoshitaka-i
5e3eb12a7b
add relu function (#1795) 2020-03-13 08:33:36 +01:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
singlav
5543d14b3f
estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo (#1785)
* estimate area under a curve defined by non-negative real-valued continuous function within a continuous interval using monte-carlo

* run black; update comments

* Use f”strings” and drop unnecessary returns

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-23 08:10:50 +01:00
singlav
b36e46b9b2
extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound (#1784)
* extend estimation of area under curve of y=x using monte carlo simulation to any given lower and upper bound

* remove doctest
2020-02-22 23:33:12 +01:00