Create problem_54 in project Euler#2451
Merged
cclauss merged 7 commits intoTheAlgorithms:masterfrom Sep 20, 2020
Merged
Conversation
Member
Author
|
Hi, I'll fix the codespell errors. What does this codespell comment trying to say?
Should I change the variable named |
cclauss
reviewed
Sep 19, 2020
cclauss
reviewed
Sep 19, 2020
cclauss
reviewed
Sep 19, 2020
cclauss
reviewed
Sep 19, 2020
cclauss
reviewed
Sep 19, 2020
- Use list comprehension instead of map - Sort imports using isort
Member
Yes. |
cclauss
reviewed
Sep 20, 2020
cclauss
reviewed
Sep 20, 2020
cclauss
reviewed
Sep 20, 2020
cclauss
reviewed
Sep 20, 2020
- 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
cclauss
reviewed
Sep 20, 2020
- Split generate_random_hands function into two: - First will generate a random hand - Second, which will be called, will return a generator object
Member
|
An awesome contribution! Thanks for doing this. |
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
* 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add solution and test files (in pytest) for project Euler problem 54
There are a couple of extra features of the PokerHand class:
PokerHand.hand_name()which returns the name of hand as stated in the Wikipedia link<, >, <=, >=, ==, !=and this in turn gives us the ability to use the builtinsortmethod andsortedfunction on a list of PokerHand objects.The test file
test_poker_hand.pyshould be picked up by Travis and it checks every function ofsol1.pythroughpytest.Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.