Files
007-Hangman/src/hangman/main.py
T
Tirsvad f07c34a5fa
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Successful in 6s
Step 1
Picking a random word and checking answers
2026-10-04 12:31:58 +08:00

23 lines
503 B
Python

"""!
@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()