Skip to content

Snowman Feedback - Ellie Alavi#41

Open
apradoada wants to merge 2 commits intoAda-C23:mainfrom
lavendercaterpillar:main
Open

Snowman Feedback - Ellie Alavi#41
apradoada wants to merge 2 commits intoAda-C23:mainfrom
lavendercaterpillar:main

Conversation

@apradoada
Copy link
Copy Markdown

Welcome to your first Pull Request (PR), Ellie! 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!

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, Ellie!

Feel free to look through the feedback I have left here. Overall, everything looks good and the suggestions I made are purely for adhering to coding conventions you will find in industry! Before I can give this code a passing score, I just need you to fix the break statement so that it passes all the tests and then you're good to go!

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. You currently don't have many, so in the future, just make sure to include a few!

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
wrong_guesses_list = []
correct_letter_guess_statuses = build_letter_status_dict(snowman_word)

while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES and not is_word_guessed(snowman_word, correct_letter_guess_statuses):
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.

This compound conditional looks good! One small thing is that this line breaks the PEP8 guidelines for line length (79 characters or less including indentation https://peps.python.org/pep-0008/#maximum-line-length). From the linked guide:

The preferred way of wrapping long lines is by using Python’s implied line continuation inside parentheses, brackets and braces. Long lines can be broken over multiple lines by wrapping expressions in parentheses.

It can definitely be tough to break up lines nicely, but when you have compound conditionals, I think the most obvious way to break things up is by the conditional itself. For example, you could do:

Suggested change
while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES and not is_word_guessed(snowman_word, correct_letter_guess_statuses):
while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES and \
not is_word_guessed(snowman_word, correct_letter_guess_statuses):

This makes it just a little easier to read!

Comment thread game.py Outdated
Comment on lines +34 to +36
for letter in snowman_word:
if letter == user_input:
correct_letter_guess_statuses[letter] = True
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 fully get where you are coming from with this particular approach! However, remember that the function on line 26 creates a dictionary called correct_letter_guess_statuses. With a dictionary, we don't need to loop through the snowman word to find the letter we are looking for. We can get away with just accessing the letter we've input directly and changing its status to True!

Suggested change
for letter in snowman_word:
if letter == user_input:
correct_letter_guess_statuses[letter] = True
correct_letter_guess_statuses[user_input] = True

Comment thread game.py
else:
wrong_guesses_list.append(user_input)

print_snowman_graphic(len(wrong_guesses_list)) # Show Snowman progress
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.

Right now, because this line is nested inside our else statement, it will only print out the snowman graphic if the user guesses a letter that is not in the word. Just for the sake of the game, it might be a good idea to move this line outside of the conditionals but still inside the while loop!

Comment thread game.py
print_word_progress_string(snowman_word, correct_letter_guess_statuses) # Show word progress
user_input = get_letter_from_user(correct_letter_guess_statuses,wrong_guesses_list)

if user_input in 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.

This is just a small thing, but for the sake of the game, it might be a nice touch to add a little message to the user to let them know if they got the letter right or wrong!

Comment thread game.py

print_snowman_graphic(len(wrong_guesses_list)) # Show Snowman progress

if is_word_guessed(snowman_word, correct_letter_guess_statuses):
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 love the way you've included checking for the win condition here within the loop! As we talked about, the one way you can get this to pass all the tests will be to change the break statement! One other thought here though is that because you are checking to see if the word wins here, you actually don't need to include the win condition within the while loop conditionals itself. This currently leads to a duplicate check when only one is needed!

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.

2 participants