Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def bot():
- def hangman():
- def random_line(file):
- lines = open(file).read().splitlines()
- return random.choice(lines)
- word = random_line('file.txt')
- letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- guess = ''
- while len (word) > 0 :
- msg = ""
- for letter in word :
- if letter in guess :
- msg = msg + letter
- if msg == word :
- print(msg)
- print("The word was :",word)
- break
- print(" Ghiceste cuvantul:",msg)
- guessss = input()
- if guessss in letters :
- guess = guess + guessss
- else:
- print(" Gresit. Introdu o alta litera :")
- guess = input()
- hangman()
- bot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement