Uh oh!
There was an error while loading. Please reload this page.
Create problem_54 in project Euler - #2451
Conversation
dhruvmanila
commented
Sep 19, 2020
Hi, I'll fix the codespell errors. What does this codespell comment trying to say?
Should I change the variable named |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Use list comprehension instead of map - Sort imports using isort
cclauss
commented
Sep 19, 2020
Yes. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- 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
Uh oh!
There was an error while loading. Please reload this page.
- Split generate_random_hands function into two: - First will generate a random hand - Second, which will be called, will return a generator object
cclauss
commented
Sep 20, 2020
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 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}.