From fb0e297f8716e49111bd1e979d10c47866fd4b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Korbanek?= Date: Fri, 8 Mar 2019 21:27:29 +0000 Subject: [PATCH] Zaktualizuj 'Projekt2/hangman.py' --- Projekt2/hangman.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Projekt2/hangman.py b/Projekt2/hangman.py index 6a82e3a..0e5b2db 100644 --- a/Projekt2/hangman.py +++ b/Projekt2/hangman.py @@ -28,8 +28,7 @@ def type_guess_word(word_file, guess_word, guessed_line): guessed_line = guessed_line [0:x] + guess_word + guessed_line[x+1:] x = x+1 else: - print("Pudlo") - print("-----------------------------") + print("\n\033[1;36;40m Pudlo") return guessed_line def user_input(input=input): @@ -47,29 +46,27 @@ def n_main(): guess_word_list = [] while a: if guessed_line == s_word: - print("\nGratulacje. Wygrales!") + print("\n\033[1;33;40m Gratulacje. Wygrales!") break - print("----------------------------------------") - print("\nPozostalo prob: {}".format(tries)) + print("\n\033[1;31;40m Pozostalo prob: {}".format(tries)) guess_word = user_input() if guess_word in guess_word_list: - print("Podano wczesniej.") + print("\n\033[1;31;40m Podano wczesniej.") continue if guess_word.isdigit(): - print("Cyfry sa niedozwolone!") + print("\n\033[1;31;40m Cyfry sa niedozwolone!") continue if len(guess_word) != 1: - print("\nDopusczalne tylko pojedyncze znaki.\n") + print("\n\033[1;31;40m Dopusczalne tylko pojedyncze znaki.\n") continue guess_word_list.append(guess_word) guessed_line = type_guess_word(s_word, guess_word,guessed_line) print (guessed_line) print("\n\033[1;32;40m Odgadles: {}".format(guess_word_list)) - print("========================================") tries = tries-1 if (tries < 1): a= False - print ("\n Nieodgadniete slowo: {} \n\n".format(s_word)) + print("\n\033[1;30;47m Nieodgadniete slowo: {} \n\n".format(s_word)) if __name__ == "__main__": n_main()