forked from aman-raza/Friends_Hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicGuessGame
More file actions
48 lines (28 loc) · 759 Bytes
/
BasicGuessGame
File metadata and controls
48 lines (28 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import random
words = ['plane', 'car', 'house', 'lamp',
'game', 'java', 'table', 'mobile',
'mouse', 'lion', 'boat']
word = random.choice(words)
print("Guess the word")
guesses = ''
lives = 10
while lives > 0:
failed = 0
for c in word:
if c in guesses:
print(c)
else:
print("▃")
failed += 1
if failed == 0:
print("You Win")
print("The word is: ", word)
break
guess = input("Guess a character: ")
guesses += guess
if guess not in word:
lives -= 1
print("That character isn't in the word, you are wrong.")
print("You have", + lives, 'live(s)')
if lives == 0:
print("You Loose")