* 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>
* 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>
* * 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>
* 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>
* Create __init__.py
* Initial commit
Not sure if this should be formatted differently. I'm open to ideas!
* Completing testing/updates
Ran code through `black`, `flake8`, and `doctest`. Added some type hints.
`doctest` is finicky on sets, so I had to sort and reformat as set to pass those tests.
* Update project_euler/problem_47/sol1.py
Nice.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Looks good
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Okay, this should work. Thank you for the reminder on map(), filter(), reduce().
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
My IDE needs a spellchecker. Or, lighter comment font.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
This means that `results = run(N)` should be updated to `results = run(n)`, correct?
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Looks good!
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_47/sol1.py
Works for me! I spent way too much time getting this to pass doctest, so any improvement is welcome.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update sol1.py
Added some suggested changes from the pull request:
* Updated tests outputs in `unique_prime_factors` function.
* Changed `@lru_cache(maxsize=5)` to `@lru_cache(maxsize=None)`
* Removed duplicate `return` line in `equality` function
* Changed `i` to `base` in run function.
* Added some commentary to `run()` function.
* Replaced `group = list(map(lambda x: base + x, [i for i in range(n)]))` with `group = [base + i for i in range(n)]`
* Update sol1.py
* Trailing whitespace
* Update sol1.py
* Update __init__.py
* Update sol1.py
* Update __init__.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Euler problem 551 sol 1: Reduce McCabe code complexity
As discussed in #2128
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* 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>
* 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>
* Solution for Euler Problem 26
* Update project_euler/problem_26/sol1.py
typo error fix.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_26/sol1.py
typo error fix
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_26/sol1.py
ok to remove, this comes from Pycharm automatically when docstring is added.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_26/sol1.py
ok to remove.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_26/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_26/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update project_euler/problem_26/sol1.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* now_divide = now_divide * 10 % divide_by_number
Co-authored-by: Christian Clauss <cclauss@me.com>
* 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>
* Create soln.py
Solution for problem 30 of Euler Project
* Update soln.py
* update soln.py
modified the changes
* if __name__ == "__main__":
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add sol3 for project_euler proble_03
* Update sol3.py
add type hint
remove unused variable
* Format code with psf/black
* add sol3 to project_euler/problem_08, modify the stepsize of the loop,will be faster than sol1