Skip to content
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

Pine - Victoria Duke and Michelle Bodart #32

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

VictoriaDuke
Copy link

We did an extension on the project by creating a function to check if the word is in the English dictionary. We imported the package english-dictionary 1.0.24 (pip install english-dictionary).

Copy link

@jbieniosek jbieniosek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this project, nicely done with the extension and the test code for the extension! This project is green.

Comment on lines +73 to +77
for letter in letter_bank:
if letter_bank.count(letter) > LETTER_POOL.count(letter):
is_freq_correct = False
#Letter frequency is incorrect. Breaks the loop and creates new hand of letter.
break

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great error checking!


def uses_available_letters(word, letter_bank):
pass
word = word.upper()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +87 to +92
if letter in letter_bank and word.count(letter) <= letter_bank.count(letter):
continue
else:
#Will return False if input word uses letters not in letter_bank,
# and/or over the quantity of the letter available in letter_bank.
return False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way to write this conditional is:

Suggested change
if letter in letter_bank and word.count(letter) <= letter_bank.count(letter):
continue
else:
#Will return False if input word uses letters not in letter_bank,
# and/or over the quantity of the letter available in letter_bank.
return False
if not letter in letter_bank or word.count(letter) > letter_bank.count(letter):
return False

score += SCORE_CHART[letter]
if len(word) >= 7:
score += 8
return score

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

highest_words = [word]
elif highest_score == score:
highest_words.append(word)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great solution!

Comment on lines +124 to +129
word = word.lower()
if word in english_dict.keys():
return True
else:
return False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice extension!

Comment on lines +119 to +122
if len(word) == 10:
return(word, highest_score)
return(min(highest_words, key=len), highest_score)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

is_valid = word_in_english_dictionary(word)

# Assert
assert is_valid == False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants