Skip to content

Creating a pull request to leave review comments for Snowman#25

Open
yangashley wants to merge 1 commit intoAda-C23:mainfrom
Viktoria2609:main
Open

Creating a pull request to leave review comments for Snowman#25
yangashley wants to merge 1 commit intoAda-C23:mainfrom
Viktoria2609:main

Conversation

@yangashley
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Author

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Really nice work on your first project here at Ada.

Please review my comments on this pull request for feedback about your submission.

Let me know if you have any questions!

Comment thread game.py
wrong_guesses = []

# Game loop - continues until win or max wrong guesses
while len(wrong_guesses) < SNOWMAN_MAX_WRONG_GUESSES:
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.

Nice job using the length of wrong_guesses_list to keep track of the number of incorrect guesses the user has made in the game.

Comment thread game.py

# Print snowman progress
print_snowman_graphic(len(wrong_guesses))
print(f"Wrong guesses: {', '.join(wrong_guesses)}")
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.

Great work using join to print out each element in a list in a human readable way!

Comment thread game.py
correct_letters = build_letter_status_dict(snowman_word)
wrong_guesses = []

# Game loop - continues until win or max wrong guesses
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.

A note about comments: Folks might find it useful to leave comments that explain what different lines/sections of code do in the beginning of their coding career. However, when we write self documenting code (code with descriptively named variables and function names) that is concise and easy to follow, then there should be no need for comments. For example, if a function is named get_letter_from_user, I can deduce what the function should do without needing to read a comment that explains what it does.

Comments add more lines of code in a codebase. More lines of code make a codebase more challenging to maintain and update and also create more areas where a bug can accidentally get introduced.

Teams have differing opinions about comments. Some teams may be ok with some comments here and there and some teams prefer no comments unless absolutely necessary. You’ll find out how your team feels when you get there!

My opinion, when it comes to reviewing your work, I prefer to not have comments because if the code is concise and clear then I should be able to understand it. In the future, I challenge you to write fewer comments and eventually remove the comments before you submit your work. If it’s challenging to understand without comments then we’ve identified areas for growth 😁

Comment thread game.py
wrong_guesses.append(guess)

# Print snowman progress
print_snowman_graphic(len(wrong_guesses))
Copy link
Copy Markdown
Author

@yangashley yangashley Mar 4, 2025

Choose a reason for hiding this comment

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

Notice that there's some repetition in your code. len(wrong_guesses_list) appears 2 times.

When we repeat our code, it makes it difficult to maintain because we need to find all the different places the repeated code appears. For example, if I wanted to change the variable name wrong_guesses_list to wrong_guesses, I'd need to look for all the places the variable I want to change appear. You could miss one and introduce a bug. Therefore, we want to keep our code DRY (Don't Repeat Yourself).

I'd prefer a variable called num_wrong_guesses declared on line 25 and then referencing that variable here on line 39 and also line 27.

num_wrong_guesses = len(wrong_guesses_list)
    while len(wrong_guesses) < SNOWMAN_MAX_WRONG_GUESSES: 
    # blah blah
    print_snowman_graphic(num_wrong_guesses)

Comment thread game.py

if is_word_guessed(snowman_word, correct_letters):
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.

What's another way the logic in this loop could be written so that you don't need to return from this if statement to end the game?

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