Skip to content

Pine - Victoria Duke and Michelle Bodart#32

Open
VictoriaDuke wants to merge 14 commits intoAda-C16:masterfrom
VictoriaDuke:master
Open

Pine - Victoria Duke and Michelle Bodart#32
VictoriaDuke wants to merge 14 commits intoAda-C16:masterfrom
VictoriaDuke:master

Conversation

@VictoriaDuke
Copy link
Copy Markdown

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
Copy Markdown

@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 thread adagrams/game.py
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great error checking!

Comment thread adagrams/game.py

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

Choose a reason for hiding this comment

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

👍

Comment thread adagrams/game.py
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
Copy link
Copy Markdown

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

Comment thread adagrams/game.py
score += SCORE_CHART[letter]
if len(word) >= 7:
score += 8
return score
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💯

Comment thread adagrams/game.py
highest_score = score
highest_words = [word]
elif highest_score == score:
highest_words.append(word)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great solution!

Comment thread adagrams/game.py
Comment on lines +124 to +129
def word_in_english_dictionary(word):
word = word.lower()
if word in english_dict.keys():
return True
else:
return False
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice extension!

Comment thread adagrams/game.py
Comment on lines +119 to +122
for word in highest_words:
if len(word) == 10:
return(word, highest_score)
return(min(highest_words, key=len), highest_score)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread tests/test_wave_05.py
is_valid = word_in_english_dictionary(word)

# Assert
assert is_valid == False No newline at end of file
Copy link
Copy Markdown

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