Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from hangman_states import *
- import random
- def losuj_slowo():
- words = ["samochod", "tree", "vegetables", "monopoly", "Katowice"]
- return random.choice(words)
- word = losuj_slowo()
- guess_word = ["_"] * len(word)
- guessed_letters = []
- state = 1
- print(word)
- print(f"Witaj w Hangmanie! Twoim zadaniem jest zgadnąć słowo!")
- print(" ".join(guess_word))
- for l in word:
- l = l.lower()
- while "_" in guess_word:
- if state == 7:
- print("Przegrałeś")
- break
- letter = input("Podaj literke").lower()
- if letter not in word:
- state+=1
- guessed_letters.append(letter)
- print("🔴 Zła litera!")
- else:
- for index, l in enumerate(word):
- if letter == l.lower():
- guess_word[index] = letter
- print("✅ Dobrze, trafiłeś")
- print(HANGMAN_STATES[-1*state])
- print(" ".join(guess_word))
Advertisement
Add Comment
Please, Sign In to add comment