Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Welcome to hangman!")
- g = open("C:\\Users\\Angela\\Documents\\Python\\word_list.txt", "r")
- word = random.choice(g.readlines())[1:]
- print("-" * len(word))
- guess = ""
- while 1:
- check = 0
- output = ""
- print("Guess a letter: ")
- b = input()
- guess += b
- for a in word:
- if a in guess:
- output += a
- check += 1
- else:
- output += "-"
- print(output)
- if check == len(word):
- break
Add Comment
Please, Sign In to add comment