Commit Graph

1909 Commits

Author SHA1 Message Date
xcodz-dot
1b637ba8ed
Create vector3_for_2d_rendering.py (#2496)
* Create vector3_for_2d_rendering.py

Edited for passing travis test

* Delete vector3_for_2d_rendering.py

* Create vector3_for_2d_rendering.py

* Update vector3_for_2d_rendering.py

Compressed the line 19 to 28 into 19 to 21

* Update vector3_for_2d_rendering.py

* Update vector3_for_2d_rendering.py

* Update vector3_for_2d_rendering.py

completly corrected pep8 errors using Pycharm IDE

* Update vector3_for_2d_rendering.py

* Update graphics/vector3_for_2d_rendering.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>

* Update graphics/vector3_for_2d_rendering.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>

* Update graphics/vector3_for_2d_rendering.py

Co-authored-by: Dhruv <dhruvmanila@gmail.com>

* Update vector3_for_2d_rendering.py

* Update vector3_for_2d_rendering.py

* Update graphics/vector3_for_2d_rendering.py

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

* Update graphics/vector3_for_2d_rendering.py

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

* Apply suggestions from code review

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

* Update vector3_for_2d_rendering.py

Added A few extra names to __author__ 😄

* Update vector3_for_2d_rendering.py

Used Pycharm to fix PEP8 errors, doctest errors

* Update vector3_for_2d_rendering.py

Added enough doctests

* Update graphics/vector3_for_2d_rendering.py

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

* Remove second main()

Co-authored-by: Dhruv <dhruvmanila@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-28 11:43:34 +02:00
Dhruv
ceacfc6079
Add algorithm for testing Project Euler solutions (#2471)
* Add file for testing Project Euler solutions

* Remove the importlib import

* Update project_euler/solution_test.py

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

* Small tweaks to project_euler/solution_test.py

* Test Project Euler solutions through Travis

* Improved testing for Project Euler solutions:

- Renamed file so that it isn't picked up by pytest
- Fail fast on validating solutions through Travis CI

* Update validate_solutions.py

* Use namedtuple for input parameters and answer

- Remove logging
- Remove unnecessary checks for PROJECT_EULER_PATH as Travis CI
  picks up the same path

* Fix flake8 errors: line too long

* Small tweaks to validate_solutions.py

* Add all answers & back to using dictionary

* Using pytest for testing Project Euler solutions

- As we want to fail fast on testing solutions, we need to test using
  this script first before we use tests written by the author.
- As pytest stops testing as soon as it receives a traceback, we need to
  use pytest-subtests to tell pytest to test all the iterations for the
  function with given parameters.

* Print error messages in oneline format

* Separated answers into a separate file:

- Add custom print function to print all the error messages at the
  end of all the tests
- Let Travis skip if this failed

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-28 08:18:19 +02:00
Dhruv
187e8ccc95
Small fix (#2498) 2020-09-27 15:05:09 +02:00
Du Yuanchao
8904af98a1
Optimization for pangram string (#2473)
* optimization for pangram string

* fixup! Format Python code with psf/black push

* Update strings/check_pangram.py

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

* updating DIRECTORY.md

* Update strings/check_pangram.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-26 22:58:59 +08:00
Abdoulaye Balde
7446e69571
Gradient Boosting Regressor (#2298)
* Stock market prediction using greadient boosting

* To reverse a string using stack

* To reverse string using stack

* Predict Stock Prices Python & Machine Learning

* Gradient boosting regressor on boston dataset

* Gradient boosting regressor implementation

* Gradient boosting regressor

* Gradient boosting regressor

* Gradient boosting regressor

* Removing files

* GradientBoostingRegressor example

* Demo Gradient Boosting

* Demo Gradient boosting

* demo of gradient boosting

* gradient boosting demo

* Fix spelling mistake

* Fix formatting

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-09-26 16:58:29 +02:00
Du Yuanchao
7f48bb8c95
Updated circular_linked_list (#2483)
* Updated circular_linked_list

* fixup! Format Python code with psf/black push

* Update data_structures/linked_list/circular_linked_list.py

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

* updating DIRECTORY.md

* delete print_list()

* test is_empty()

* test is_empty return False

* fixup! Format Python code with psf/black push

* fixed indentation

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-26 22:57:09 +08:00
Christian Clauss
db0db01d87
Use self-documenting option instead of cryptic option (#2487)
* Use self-documenting option instead of cryptic option

@mateuszz0000 Your review, please.  Pretend that you do not know what `-L` stands for.  How many keystrokes and clicks does it take to confirm the purpose of this option?

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-26 16:54:41 +02:00
Du Yuanchao
72fe611462
Updated lower and upper (#2468)
* update lower and upper

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-26 01:58:40 +08:00
Thomas Voss
e92cd9d5c5
Update morse_code_implementation.py (#2386)
* Update morse_code_implementation.py

Added more characters to MORSE_CODE_DICT for a more complete dictionary.
Split words with "/" instead of a space as is standard.
Fixed bug when encrypting a message with a comma.

* Fixed comment typo
2020-09-25 19:03:15 +02:00
Du Yuanchao
b81fcef66b
Fixed linked list bug (#2481)
* * fixed __getitem__() function
* add test

* * updated doctests
* updated __setitem__() func

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-25 18:08:57 +02:00
Du Yuanchao
18f1dcd48a
Updated singly_linked_list (#2477)
* Updated singly_linked_list

* fixup! Format Python code with psf/black push

* undo __repr__

* updating DIRECTORY.md

* UNTESTED CHANGES: Add an .__iter__() method.

This will break tests, etc.

* fixup! Format Python code with psf/black push

* len(tuple(iter(self)))

* fixed __repr__()

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

* Update data_structures/linked_list/singly_linked_list.py

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

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-25 16:09:29 +02:00
Du Yuanchao
a196a36514
Fixed bugs (#2474)
* fixed bug

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-25 15:20:09 +02:00
Abdujabbar Mirkhalikov
53c2a24587
added type hints and doctests for minimax algorithm (#2478)
* added type hints and doctests for minimax algorithm

* Update backtracking/minimax.py

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

* last fix

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-25 15:16:05 +02:00
Kushagra Bansal
daa1b4d70f
Created problem_97 in project euler (#2476)
* Create __init__.py

* Add files via upload

* Update sol1.py

* Update sol1.py

* Update sol1.py

* Update project_euler/problem_97/sol1.py

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

* Update sol1.py

* Update project_euler/problem_97/sol1.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-25 11:52:19 +02:00
Guillaume Rochedix
f564c9d7c6
Wiggle sort (#2419)
* wiggle sort : type hint + doctest

* fixed function name in docstring

* correction
2020-09-25 09:18:00 +02:00
Dhruv
08eb1efafe
Add solution() for problem 54 of Project Euler (#2472)
* Add solution() for problem 54 of Project Euler

* Add type hints for solution() function
2020-09-24 15:16:55 +02:00
Du Yuanchao
3a275caf01
Fixed remove duplicate (#2470)
* fixed remove duplicate

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-24 19:14:52 +08:00
Du Yuanchao
902fe1c907
Fixed reverse words algorithm (#2469)
* updated reversed words

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-24 19:12:52 +08:00
Vivek
4a3b8d682e
Added binary_xor_operator.py and binary_and_operator.py (#2433)
* Added binary_and_operator.py & binary_xor_operator.py

* Updated binary_and_operator.py

* Updated binary_xor_operator.py

* Updated binary_xor_operator.py
2020-09-24 09:30:22 +02:00
spamegg
5f9be0a613
Add Python type hints and doctests to other/two_sum.py (#2467)
* Add Python type hints and doctests to other/two_sum.py

#2465

* Update other/two_sum.py

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

* Update other/two_sum.py

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

* Update two_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-23 21:55:51 +02: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
Dhruv
6e6a49d19f
Config Travis CI for two jobs (#2463)
* Testing Travis CI configuration for project Euler

* Fix: Installing mypy and pytest-cov for testing

* Remove unnecessary checks for project_euler job

* Removing branches section

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-23 13:24:32 +02:00
Du Yuanchao
a1ea76bcf3
Optimization problem_10 in project_euler (#2453)
* optimization for problem09 in project_euler

* added benchmark code

* fixup! Format Python code with psf/black push

* Update project_euler/problem_09/sol1.py

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

* updating DIRECTORY.md

* Update project_euler/problem_09/sol1.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-22 15:15:11 +02:00
Abhinav Anand
718be54dbb
Update sol1.py (#2455) 2020-09-20 21:33:26 +02:00
Dhruv
ea0759dbaa
Create problem_54 in project Euler (#2451)
* Add solution and test files for project euler 54

* Update sol1.py

* updating DIRECTORY.md

* Fix: use proper path to open files

* Commit suggestions:

- Use list comprehension instead of map
- Sort imports using isort

* Changes made as suggested (simplified a lot):

- List and set comprehension instead of itemgetter
- Using enumerate as it's easy to read
- Divided into list of card values and set of card suit as set will
  remove all the duplicate values. So, no need for double indexing.
- Add test for testing multiple calls to five_high_straight function

* Add suggestions and simplified:

- Split generate_random_hands function into two:
  - First will generate a random hand
  - Second, which will be called, will return a generator object

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-20 13:52:13 +02:00
Susmith98
9b73884def
Added a function that checks if given string can be rearranged to form a palindrome. (#2450)
* Added check_if_string_can_be_rearranged_as_palindrome function.

* Added counter implementation and benchmark function.

* flake changes

* Update and rename check_if_string_can_be_converted_to_palindrome.py to can_string_be_rearranged_as_palindrome.py

* Update can_string_be_rearranged_as_palindrome.py

* #

Co-authored-by: svedire <VedireSusmith_Reddy@intuit.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-19 21:49:37 +02:00
Christian Clauss
b05081a717
Update and rename bin_to_octal.py to binary_to_octal.py (#2449)
* Update and rename bin_to_octal.py to binary_to_octal.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 14:58:08 +08:00
mohammadreza490
b22596cd96
bin_to_octal (#2431)
* bin_to_octal

Converts binary values to the octal equivalent.

* Update bin_to_octal

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

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

* Rename bin_to_octal to bin_to_octal.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-09-19 13:36:56 +08:00
Christian Clauss
697495b017
Fix copy / paste oversight (#2448) 2020-09-19 07:25:18 +02:00
Christian Clauss
363858ef3b
hyphen_files = [file for file in filepaths if "-" in file] (#2447)
* hyphen_files = [file for file in filepaths if "-" in file]

* updating DIRECTORY.md

* Rename recursive-quick-sort.py to recursive_quick_sort.py

* updating DIRECTORY.md

* Rename aho-corasick.py to aho_corasick.py

* updating DIRECTORY.md

* Rename polynom-for-points.py to polynom_for_points.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 07:13:10 +02:00
kanthuc
ecac7b0973
Contains loops.py add (#2442)
* added an algorithm which checks a linked list for loops and returns true if one is found

* added doctests and clarified meaning of loop

* Define Node.__iter__()

* Update and rename has_loop.py to has_duplicate_data.py

* Update has_duplicate_data.py

* Update has_duplicate_data.py

* Update and rename has_duplicate_data.py to has_loop.py

* Update has_loop.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-18 22:53:50 +02:00
Du Yuanchao
dc415ec14a
Added double linear search recursion (#2445)
* double linear search recursion

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-18 09:55:02 +02:00
avych
0dea049f44
Added static type checking to polynom-for-points.py towards issue #2128 (#2335)
* Added static type checking to linear_algebra/src/polynom-for-points.py

* Fixed TravisCI errors

* Update polynom-for-points.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-18 08:37:49 +02:00
Du Yuanchao
2de2267319
Updated problem_06 in Project Euler (#2439)
* * rename variable
* fix type hint
* fix doctest

* added test function

* fixed import error

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-17 11:37:53 +02:00
poloso
86fb2991d5
Corrected filename and include static types (#2440)
* Corrected name and include static types

- The name of the file is now compliant with python naming conventions
- Add static type as stated in contributing guidelines

* Apply suggestions from code review

- Delete documentation line to run doctests
- Delete type hints for variables that comes from functions

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

* Add edge cases tests.

* print(f"{target} was {not_str}found in {sequence}")

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-17 09:41:10 +02:00
Ashley Jeji George
1ac75f4683
Create priority_queue_using_list.py (#2435)
* Create priority_queue_using_list.py

* Update priority_queue_using_list.py

* Update priority_queue_using_list.py

* Update priority_queue_using_list.py

* Maximum queue size is 100

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-16 18:42:53 +02:00
Du Yuanchao
cbbc43ba3a
Updated problem_04 in project_euler (#2427)
* Updated problem_04 in project_euler

* fixup! Format Python code with psf/black push

* That number is larger than our acceptable range.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 22:33:08 +02:00
Hasenn
10aa214fcb
Docstrings and formatting improvements (#2418)
* Fix spelling in docstrings

* Improve comments and formatting

* Update print statement to reflect doctest change

* improve phrasing and apply black

* Update rat_in_maze.py

    This method is recursive starting from (i, j) and going in one of four directions:
    up, down, left, right.
    If a path is found to destination it returns True otherwise it returns False.

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 14:40:27 +02:00
Ashley Jeji George
799fde4c07
Update linear_search.py (#2422)
* Update linear_search.py

Python implementation of recursive linear search algorithm

* Update linear_search.py

Added different doctests
Added the parameter hints
Handled the exception

* Update linear_search.py

added parameter hints to linear_search

* Update linear_search.py

Both the functions return the index if the target is found and -1 if it is not found
The rec_linear_search raises an exception if there is an indexing problem
Made changes in the doc comments

* Update linear_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 12:44:46 +02:00
Santosh Mohan Rajkumar
4e5b730e85
recaptchaVerification (#2417)
* recaptchaVerification

* recaptchaVerification

* recaptchaVerification1

* recaptchaVerification2

* recaptchaVerification3

* recaptchaVerification4

* recaptchaVerificatio5

* recaptchaVerificatio5

* recaptchaVerificatio6

* drawOnVideoStreamOpenCV

* matrixInverseMCAmethod

* fixingImports

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes1

* recaptchaVerificationfixes1

* authenticate = login = render = redirect = print

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 22:26:15 +02:00
Du Yuanchao
44b8cb0c81
Updated Stack (#2414)
* * Added type hints
* Added test
* Formated code

* updating DIRECTORY.md

* Update stack.py

* Test error conditions for pop, peek, and

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 13:56:03 +02:00
Du Yuanchao
d6bff5c133
Renamed files and fixed Doctest (#2421)
* * Renamed files
* Fiexed doctest

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-13 13:27:20 +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
Guillaume Rochedix
f754c0d31f
Jump search (#2415)
* jump_search: doctest, docstring, type hint, inputs

* jumpsearch.py: case number not found

* trailing whitespace jump search
2020-09-12 07:50:12 +02:00
Meysam
2e790ce4ca
file-transfer: writing tests and ensuring that all is going well (#2413)
* file-transfer: writing tests and ensuring that all is going well

* def send_file(filename: str = "mytext.txt", testing: bool = False) -> None:

* send_file(filename="mytext.txt", testing=True)

* Update send_file.py

* requirements.txt: lxml

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 23:13:43 +02:00
Santosh Mohan Rajkumar
c676956030
lxmlCovidDataFetch (#2416)
* lxmlCovidDataFetch

* lxmlCovidDataFetch1

* Update worldometers_covid_with_lxml.py

* Rename worldometers_covid_with_lxml.py to covid_stats_via_xpath.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 22:25:05 +02:00
Marcos Cannabrava
a191f89fe2
Fix Non Recursive Depth First Search (#2207)
* Fix Non Recursive Depth First Search

* Unindent docstring

* Reindent docstring by 1 space

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 16:23:26 +02:00
mohammadreza490
1b3fec3f1f
binary_to_decimal converter (#2400)
* Create binary_to_decimal

binary to decimal converter

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 06:16:43 +02:00
mohammadreza490
696cd47e15
octal_to_decimal converter (#2399)
* Create octal_to_decimal

octal to decimal converter

* Update octal_to_decimal

* Update conversions/octal_to_decimal

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-10 10:37:29 +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