summaryrefslogtreecommitdiff
path: root/comp/hw/109/hangman.py
blob: 9749838f2e07eb358bd4246a4fa5297f2d88d869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import random
words = ["hello", "there", "this", "is", "a", "line"]

word = words[random.randint(0,len(words)-1)]

print(len(word))

for i in range(5):
    letter = input("guess a letter: ")
    if letter in word:
        print("yes")
    else:
        print("no")

guess = input("guess the word: ")
if guess == word:
    print("you win")
else:
    print("!(you win)")