-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Pcc02 #848
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
Pcc02 #848
Conversation
| def get_possible_dict_words(draw): | ||
| """Get all possible words from draw which are valid dictionary words. | ||
| Use the _get_permutations_draw helper and DICTIONARY constant""" | ||
| all_options = [] |
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.
redundant / gets overwritten in next statement
| [int(letter.value) for letter in distribution] | ||
| )) | ||
|
|
||
| assert LETTER_SCORES['A'] == 1 |
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.
would these asserts be better placed in a the tests?
| all_options = _get_permutations_draw(draw) | ||
|
|
||
| dictionary_words = [] | ||
| for word in all_options: |
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.
could use a listcomp:
[word for word in all_options if word.lower() in DICTIONARY]
| else: | ||
| raise ValueError("You need to use the letters shown") | ||
|
|
||
| if word.lower() not in DICTIONARY: |
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.
could possibly drop this check, because get_possible_dict_words() already filters dictionary only words, however that does mean that it always need to be called before this function = coupling, so could leave in as well
ATTENTION: before clicking "Create Pull Request" please submit some meta data, thanks!
Difficulty level (1-10): [8]
Estimated time spent (hours): [2.5]
Completed (yes/no): [yes]
I stretched my coding skills (if yes what did you learn?): [itertools]
Other feedback (what can we improve?): []