Conversation
apradoada
left a comment
There was a problem hiding this comment.
Great job, Dana!
Feel free to look through the feedback I have left here. Overall, the logic is sound, your tests pass and everything looks good! The suggestions I made are purely for adhering to coding conventions you will find in industry! None of them require updates unless you would like to update them.
Two other small general notes:
-
When it comes to commenting your code, it can be a good idea to include comments for blocks of code to describe what they are doing. I don't see any comments here, so feel free to include some in future projects!
-
I see there is just one commit. This is a pretty basic project, so that makes sense. As we do more robust assignments, you will hear us say "commit early and often" during the program. In general, smaller and more commits can be helpful to see the full history of what you have done and go back and figure out where breaks happen! As we do larger projects, feel free to make more commits!
| pass | ||
| correct_letter_guess_statuses = build_letter_status_dict(snowman_word) | ||
| wrong_guesses_list = [] | ||
| wrong_guesses_count = 0 |
There was a problem hiding this comment.
I like the instinct to separate out the wrong_guesses_count variable here as it can often be a great idea to parse out each specific variable. That being said, a list object in python actually comes with a built in variable that keeps track of this for us! As a result, we could say that wrong_guesses_count is actually the same thing as len(wrong_guesses_list). While it isn't inherently bad to do something like this, it does mean that we are holding on to duplicate data, which is not ideal! I would recommend using the len() function here where you can!
| while wrong_guesses_count < SNOWMAN_MAX_WRONG_GUESSES: | ||
| print_snowman_graphic(wrong_guesses_count) | ||
| print_word_progress_string(snowman_word, correct_letter_guess_statuses) | ||
| print("Wrong guesses so far:", " ".join(wrong_guesses_list)) |
There was a problem hiding this comment.
Really nice use of the join method here! If we just used a statement like print(wrong_guesses_list), we would have ended up with a list that includes the brackets before and after ([ ]) and quotes around each letter. Your approach gives your program a more natural flow and look.
| if is_word_guessed(snowman_word, correct_letter_guess_statuses): | ||
| print_word_progress_string(snowman_word, correct_letter_guess_statuses) | ||
| print("Congratulations, you win!") | ||
| return |
There was a problem hiding this comment.
Using a return statement to end the loop as soon as a win condition is met is such a smart move! I am a huge advocate for ending a function early when it makes sense!
| print_snowman_graphic(wrong_guesses_count) | ||
| print("Sorry, you lose! The word was", snowman_word) |
There was a problem hiding this comment.
You've made a great choice here as well by recognizing that the win condition is handled in the loop so we don't have to worry with any conditionals outside of the loop! Great catch!
Welcome to your first Pull Request (PR), Dana! In industry, when you want to merge any changes you have made to an existing codebase, a PR is used as a form of code review where a manager or peer can easily see the changes that have been made and review the new code that has been added! We will discuss them further in Unit 1, but they will be the primary method we use to give feedback on projects! Feel free to look through my comments and don't hesitate to reach out if you have any questions!