Zaktualizuj 'hangman.py'

This commit is contained in:
Łukasz Korbanek 2019-03-08 20:57:44 +00:00
parent e3b1270c7a
commit 23336b4b4b

View File

@ -28,12 +28,12 @@ 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("Zły strzał") print("Zly strzal")
print("-----------------------------") print("-----------------------------")
return guessed_line return guessed_line
def user_input(input=input): def user_input(input=input):
letter = input("Podaj literę: ") letter = input("Podaj litere: ")
return letter return letter
@ -48,7 +48,7 @@ def n_main():
guess_word_list = [] guess_word_list = []
while a: while a:
if guessed_line == s_word: if guessed_line == s_word:
print("\nGratulacje, wygrałeś!") print("\nGratulacje, wygrałes!")
break break
print("----------------------------------------") print("----------------------------------------")
print("\nPozostało prób = {}".format(tries)) print("\nPozostało prób = {}".format(tries))
@ -57,7 +57,7 @@ def n_main():
print("already guess") print("already guess")
continue continue
if guess_word.isdigit(): if guess_word.isdigit():
print("Liczby nie są dozwolone") print("Liczby nie sa dozwolone")
continue continue
if len(guess_word) != 1: if len(guess_word) != 1:
print("\n Dozwolone tylko pojedyncze litery!\n") print("\n Dozwolone tylko pojedyncze litery!\n")
@ -70,7 +70,7 @@ def n_main():
tries = tries-1 tries = tries-1
if (tries < 1): if (tries < 1):
a= False a= False
print ("\n So tries left sorry..the secret word is {} \U0001F622 \U0001F622\n\n".format(s_word)) print ("\n Nie udalo ci sie. Chodziło o slowo {} \n\n".format(s_word))
if __name__ == "__main__": if __name__ == "__main__":
n_main() n_main()