Step 1
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s

Picking a random word and checking answers
This commit is contained in:
2026-10-04 12:31:58 +08:00
commit f07c34a5fa
12 changed files with 530 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
"""!
@file main.py
@brief Command-line interface for Hangman.
"""
from hangman.game import choose_word, is_in_word
def main() -> None:
"""!
@brief Entry point: pick a random word and check one guessed letter.
"""
word = choose_word()
guess = input("Guess a letter: ").strip()
if is_in_word(word, guess):
print(f"Right, '{guess.lower()}' is in the word.")
else:
print(f"Wrong, '{guess.lower()}' is not in the word.")
if __name__ == "__main__":
main()