-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create problem_54 in project Euler #2451
Conversation
Hi, I'll fix the codespell errors. What does this codespell comment trying to say?
Should I change the variable named |
- Use list comprehension instead of map - Sort imports using isort
Yes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool!
- 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
- Split generate_random_hands function into two: - First will generate a random hand - Second, which will be called, will return a generator object
An awesome contribution! Thanks for doing this. |
* 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>
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 builtinsort
method andsorted
function on a list of PokerHand objects.The test file
test_poker_hand.py
should be picked up by Travis and it checks every function ofsol1.py
throughpytest
.Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.