-
Notifications
You must be signed in to change notification settings - Fork 57
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
base: master
Are you sure you want to change the base?
Conversation
…_in_english_dictionary() to ignore input word capitalization.
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.
Great work on this project, nicely done with the extension and the test code for the extension! This project is green.
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 |
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.
Great error checking!
|
||
def uses_available_letters(word, letter_bank): | ||
pass | ||
word = word.upper() |
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.
👍
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 |
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.
Another way to write this conditional is:
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 |
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.
💯
highest_words = [word] | ||
elif highest_score == score: | ||
highest_words.append(word) |
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.
Great solution!
word = word.lower() | ||
if word in english_dict.keys(): | ||
return True | ||
else: | ||
return False |
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.
Nice extension!
if len(word) == 10: | ||
return(word, highest_score) | ||
return(min(highest_words, key=len), highest_score) |
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.
👍
is_valid = word_in_english_dictionary(word) | ||
|
||
# Assert | ||
assert is_valid == False |
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.
Fantastic!
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).