-
Notifications
You must be signed in to change notification settings - Fork 69
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
Whales - Alexa Coffman and Uyen Vong #36
base: master
Are you sure you want to change the base?
Conversation
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.
Wonderful work, Alexa and Uyen! 🚀
Your tests pass, your logic is superb, and I can wax poetic about your spiffy update_best_word
function all day long. Y'all have made great choices regarding your data types and your code is exceptionally clean and efficient. This project is a Green. 🟢
Let me know if you have any questions on the feedback. Keep it up!
while len(drawn_letters) < 10: | ||
rand_index = randint(0, len(letter_pool_copy)-1) | ||
drawn_letters.append(letter_pool_copy.pop(rand_index)) |
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.
Interesting way to randomly pick a letter! I also love that you modeled your LETTER_POOL
list to contain the correct frequency of letters in a bag. Great work!
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.
But also...what if the instructors were feeling ~ chaotic ~ and said there were 100,000 tiles in the pool in total? Could you have programmatically made the LETTER_POOL
list? (I'm sure you could have!)
# create a copy of letter bank so we don't alter original list | ||
letter_bank_copy = deepcopy(letter_bank) | ||
word = word.upper() | ||
valid_word = True |
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.
This is soooo pythonic! 🐍 I adore how y'all set a boolean for valid_word
at the top of the function and reassign on L56 depending on the condition, then return this boolean only once in L60! While the following is acceptable:
if [valid conditional]:
return True
else:
return False
What y'all did (set a boolean variable to have only one return statement at the end of the function, like below) is a Pythonista's dream! Great work!
valid = True
if [not valid conditional]:
valid = False
return valid
if word == None: | ||
return None |
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 validation check!
"word" : "", | ||
"score" : 0 | ||
} |
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.
Love the organization of best word and score as a dictionary! 🤩
best_word["score"] = score | ||
best_word["word"] = 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.
Lovely helper function! 💯
best_word["score"] = score | ||
best_word["word"] = word | ||
return best_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.
Python (and most languages, if I think of it) likes it when you have a newline at the end of the file. (Why? Because it's one of those Just Unix/Computer Things, I guess?)
No description provided.