Answer by pun_intended for Simplifying a Scrabble Word Finder - Python
Editing the code based on the feedback from everyone below, this is what I've come up with: LETTER_SCORE = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, "f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m":...
View ArticleAnswer by 200_success for Simplifying a Scrabble Word Finder - Python
You have some generally good ideas, especially for a beginner. However, I echo @JoshDawson's critique that your functions are not well designed to make the code readable. Code organization Function...
View ArticleAnswer by Joshua Dawson for Simplifying a Scrabble Word Finder - Python
Code Cohesion Several of your functions are doing too much work. For example dict_maker gets input from the user (not specified in docstring). It would be much better to pass that user input as a...
View ArticleAnswer by Solomon Ucko for Simplifying a Scrabble Word Finder - Python
A combination of other answers plus my own changes (with changes highlighted/explained in comments): SCORES = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, "f": 4, "i": 1, "h": 4, "k": 5, "j": 8,...
View ArticleAnswer by MarianD for Simplifying a Scrabble Word Finder - Python
Your function definition def calc_score(word): """Calculate the score of a given word.""" word_score = 0 for x in word: word_score += scores[x] return word_score may be as simple as def...
View ArticleAnswer by Lukasz Salitra for Simplifying a Scrabble Word Finder - Python
The program is pretty good and clean so far, the docstrings are clear and it's easy to follow what's going on. The scores dictionary is a constant, so it should be all uppercase. Use a context manager...
View ArticleAnswer by MarianD for Simplifying a Scrabble Word Finder - Python
Instead of scores = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, "f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m": 3, "l": 1, "o": 1, "n": 1, "q": 10, "p": 3, "s": 1, "r": 1, "u": 1, "t": 1, "w": 4,...
View ArticleSimplifying a Scrabble Word Finder - Python
I'm very new to coding and am trying to work through projects for practical review of what I know, but I would like to be able to simplify/improve what I've made. This is a project I saw online that I...
View Article