Conversation
mikellewade
left a comment
There was a problem hiding this comment.
Nice work, Stella! Please let me know if you have any questions about the feedback left by me!
| correct_letter_guess_statuses = build_letter_status_dict(snowman_word) | ||
| wrong_guesses_list = [] | ||
|
|
||
| while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES and not is_word_guessed(snowman_word, correct_letter_guess_statuses): |
There was a problem hiding this comment.
Nice work with this while loop! We don't actually know how many times it will take a user to guess the word or hit the limit of wrong guesses (could keep make invalid guesses) so this the perfect choice for that situation!
We could also rework your loop to depend on just the wrong number of guesses or if the word was guessed. We could treat the other condition like a flag and exit out of our function early if said condition is met. These changes would look a little something like this:
while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES:
...
if is_word_guessed:
print(f"Congratulations, you win!")
returnWith the return keyword not only do we exit out of the loop but also the function.
| print_word_progress_string(snowman_word, correct_letter_guess_statuses) | ||
| user_input = get_letter_from_user(correct_letter_guess_statuses, wrong_guesses_list) | ||
|
|
||
| if user_input in snowman_word: |
There was a problem hiding this comment.
Another way that this could be done is by checking the dictionary that was constructed with build_letter_status_dict. There are some advantages (Time Complexity) here that we've not talked about yet but it doesn't hurt to think through how it could be done!
| wrong_guesses_list.append(user_input) | ||
|
|
||
| print_snowman_graphic(len(wrong_guesses_list)) | ||
| print(f"Wrong guesses: {wrong_guesses_list}") |
There was a problem hiding this comment.
For a better user experience, how could we alter this print statement so that the [] aren't wrapped around the guesses of a player?
| if is_word_guessed(snowman_word, correct_letter_guess_statuses): | ||
| print("Congratulations, you win!") | ||
| else: | ||
| print(f"Sorry, you lose! The word was {snowman_word}") |
There was a problem hiding this comment.
You make this check twice, is_word_guessed in your code. One is in your while loop and the other is here. If you make the modification I suggested in comment about your while loop we could get rid of this check and move your else block logic an indentation level higher.
No description provided.