From d9ff0d78296933bf37fa4ba2682bc2a807c8f33b Mon Sep 17 00:00:00 2001 From: Masha Gorai <151106988+mkgrl@users.noreply.github.com> Date: Thu, 23 Nov 2023 13:33:34 +0200 Subject: [PATCH] Update main.py --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 99603fd..4a00f3b 100644 --- a/main.py +++ b/main.py @@ -25,9 +25,11 @@ def is_game_over(): print(f"Can you make up {WORDS_TO_WIN} words from letters in word provided by me?") print(f"Your word is '{word}'") - while not is_game_over(): guess = input("Your next take: ") + if is_word_already_guessed(guess): + print("You've already guessed that word. Try a different one.") + continue if guess in full_list: guessed += 1 guesses.append(guess) @@ -38,3 +40,5 @@ def is_game_over(): else: errors += 1 print(f"Oops :( No such word, you have {ERRORS_TO_LOSE - errors} lives more") + print(f"Game over! You have run out of lives. Better luck next time!") + exit() \ No newline at end of file