Zaktualizuj 'Projekt2/hangman.py'

This commit is contained in:
Łukasz Korbanek 2019-03-08 21:34:02 +00:00
parent 08ce474f13
commit e3749953c2

View File

@ -17,7 +17,7 @@ def get_secret_word(word_file="/usr/share/dict/words"):
return random.choice(good_words) return random.choice(good_words)
def get_masked_word(word_file): def get_masked_word(word_file):
mask_word="\033[1;36;40m *" * len(word_file) mask_word=" *" * len(word_file)
return mask_word return mask_word
def type_guess_word(word_file, guess_word, guessed_line): def type_guess_word(word_file, guess_word, guessed_line):
@ -28,11 +28,11 @@ def type_guess_word(word_file, guess_word, guessed_line):
guessed_line = guessed_line [0:x] + guess_word + guessed_line[x+1:] guessed_line = guessed_line [0:x] + guess_word + guessed_line[x+1:]
x = x+1 x = x+1
else: else:
print("\n\033[1;31;40m Pudlo") print("\n\033[1;31;40m Pudlo\n")
return guessed_line return guessed_line
def user_input(input=input): def user_input(input=input):
letter = input(" Podaje litere:") letter = input(" Podaje litere:\n")
return letter return letter