Conversation
mikellewade
left a comment
There was a problem hiding this comment.
Renata, great work! Your code organized well and you made some great design decisions! If you have any questions about the comments I left please feel free to reach out!
| # random_word_generator = RandomWord() | ||
| # snowman_word = random_word_generator.word( | ||
| # word_min_length=SNOWMAN_MIN_WORD_LENGTH, | ||
| # word_max_length=SNOWMAN_MAX_WORD_LENGTH) |
There was a problem hiding this comment.
Don't forget you want to delete comments like these. We usually only want to leave comments when the information is vital. However, I think these are safe to remove given that they are just variables.
| correct_letter_guess_statuses = build_letter_status_dict(snowman_word) | ||
| wrong_guesses_list = [] | ||
|
|
||
| while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES: |
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!
Also, I love how you used the provided len function to get access to the number of wrong guesses a player has made.
| while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES: | ||
| user_input = get_letter_from_user(correct_letter_guess_statuses, wrong_guesses_list) | ||
|
|
||
| if user_input in correct_letter_guess_statuses: |
There was a problem hiding this comment.
Love this! In the near future you will see how searching for a key in a dictionary has a considerable advantage over searching for an element in a list (Time Complexity if you you are interested!)
| print(f"The letter {user_input} is not in the word") | ||
| wrong_guesses_list.append(user_input) |
|
|
||
| print_snowman_graphic(len(wrong_guesses_list)) | ||
| print_word_progress_string(snowman_word, correct_letter_guess_statuses) | ||
| print(f"Wrong guesses: {', '.join(wrong_guesses_list)}") |
There was a problem hiding this comment.
Nice string interpolation here! This results in a cleaner user experience!
|
|
||
| if is_word_guessed(snowman_word, correct_letter_guess_statuses): | ||
| print('Congratulations, you win!') | ||
| return |
There was a problem hiding this comment.
Nice use of the return keyword. This allows for us to exit not only the while loop early if this condition is met but also the function as a whole.
| print(f'Sorry, you lose! The word was {snowman_word}') | ||
| return |
There was a problem hiding this comment.
With this indentation level this will only run if the user exceeds the max number of wrong guess, great work!
No description provided.