Skip to content

Vivian Soo - C24 Crow#26

Open
mikellewade wants to merge 1 commit intoAda-C24:mainfrom
tsztin0217:main
Open

Vivian Soo - C24 Crow#26
mikellewade wants to merge 1 commit intoAda-C24:mainfrom
tsztin0217:main

Conversation

@mikellewade
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Author

@mikellewade mikellewade left a comment

Choose a reason for hiding this comment

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

Great work on your first Ada project, Vivian!

Comment thread game.py
'Sorry, you lose! The word was {snowman_word}' if the player loses
"""
pass
print(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.

Looks like this was left behind from testing. You'll want to scrub comments/lines like these from your codebase before making a PR. Leaving them behind can lead to bugs or a cluttered codebase.

Suggested change
print(snowman_word)

Comment thread game.py
Comment on lines +24 to +25
correct_letter_guess_statuses = build_letter_status_dict(snowman_word)
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.

Consider adding a few blank lines within your function to separate logically distinct sections of the code (e.g., setup, processing, return). According to PEP 8, blank lines can improve readability by visually grouping related operations. Right now, everything runs together, which can make it harder to quickly understand the structure and flow of your function.

Suggested change
correct_letter_guess_statuses = build_letter_status_dict(snowman_word)
wrong_guesses_list = []
correct_letter_guess_statuses = build_letter_status_dict(snowman_word)
wrong_guesses_list = []

Adding a space below will visually separate this logic from the guessing logic, making it easier to digest.

Comment thread game.py
print(snowman_word)
correct_letter_guess_statuses = build_letter_status_dict(snowman_word)
wrong_guesses_list = []
while len(wrong_guesses_list) < 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 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!

Comment thread game.py
wrong_guesses_list = []
while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES:
print_word_progress_string(snowman_word, correct_letter_guess_statuses)
user_input = get_letter_from_user(correct_letter_guess_statuses, 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.

This line of characters exceeds (due to the indentation) the suggested 80 character limit for readability. You'd want to use the PEP 8 Style Guidelines for line continuation to break this up onto multiple lines.

Suggested change
user_input = get_letter_from_user(correct_letter_guess_statuses, wrong_guesses_list)
user_input = get_letter_from_user(
correct_letter_guess_statuses,
wrong_guesses_list)

Comment thread game.py
while len(wrong_guesses_list) < SNOWMAN_MAX_WRONG_GUESSES:
print_word_progress_string(snowman_word, correct_letter_guess_statuses)
user_input = get_letter_from_user(correct_letter_guess_statuses, wrong_guesses_list)
if user_input in 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.

Note that the if user_input in correct_letter_guess_statuses is shorthand (in and not in) for:

for element in sequence: 
    if element == sought_after: 
        return False
    return True

You can use this syntax to perform the above logic over a multiple kinds of iterables/sequences in Python. Later in the curriculum we will learn that they don't all have the same performance (Big O).

Comment thread game.py
Comment on lines +34 to +35
print(f"The letter {user_input} is not in the word")
wrong_guesses_list.append(user_input)
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 common rule of thumb is to perform the an operation and then after it is successful alert the user. This is so that there are no false positives sent to the user just in case of some failure in your code after the alert is since. With the print line being placed after it can only execute upon success of the prior lines.

Suggested change
print(f"The letter {user_input} is not in the word")
wrong_guesses_list.append(user_input)
wrong_guesses_list.append(user_input)
print(f"The letter {user_input} is not in the word")

Comment thread game.py
wrong_guesses_list.append(user_input)

print_snowman_graphic(len(wrong_guesses_list))
print(f"Wrong guesses: {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.

For a better user experience, how could we alter this print statement so that the [] aren't wrapped around the guesses of a player?

Suggested change
print(f"Wrong guesses: {wrong_guesses_list}")
print(f"Wrong guesses: {wrong_guesses_list}")

Comment thread game.py
Comment on lines +39 to +45
if (not is_word_guessed(snowman_word, correct_letter_guess_statuses)
and len(wrong_guesses_list) == SNOWMAN_MAX_WRONG_GUESSES):
print(f"Sorry, you lose! The word was {snowman_word}")
return
if is_word_guessed(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.

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. An alternative solution would be to move this logic outside of the while loop. What do you think would be the advantages/disadvantages would be for that kind of solution?

@mikellewade mikellewade changed the title Vivan Soo - C24 Crow Vivian Soo - C24 Crow Sep 5, 2025
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