Skip to content

Snowman Feedback - Dana Al Shaar#39

Open
apradoada wants to merge 1 commit intoAda-C23:mainfrom
DanaMJZ:main
Open

Snowman Feedback - Dana Al Shaar#39
apradoada wants to merge 1 commit intoAda-C23:mainfrom
DanaMJZ:main

Conversation

@apradoada
Copy link
Copy Markdown

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!

@apradoada apradoada changed the title update game.py Snowman Feedback - Dana Al Shaar Mar 7, 2025
Copy link
Copy Markdown
Author

@apradoada apradoada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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!

  2. 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!

Comment thread game.py
pass
correct_letter_guess_statuses = build_letter_status_dict(snowman_word)
wrong_guesses_list = []
wrong_guesses_count = 0
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread game.py
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))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread game.py
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
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment thread game.py
Comment on lines +45 to +46
print_snowman_graphic(wrong_guesses_count)
print("Sorry, you lose! The word was", snowman_word)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant