-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path#Step 1.py
More file actions
49 lines (36 loc) · 984 Bytes
/
#Step 1.py
File metadata and controls
49 lines (36 loc) · 984 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
49
#Step 1
import random
from logo import stages
end_of_game = False
from word_list import word_list
List = word_list
chosen_word = random.choice(List)
Lives = 6
from logo import logo
print(logo)
print(f"Psst the word is {chosen_word}")
display = []
word_length = len(chosen_word)
for _ in range(word_length):
display += "_"
print(word_length)
while not end_of_game:
guess = input("Enter: ").lower()
for p in range(word_length):
letter = chosen_word[p]
#print(f"Current position: {p}\
# Current letter: {letter}\
#Guessed letter: {guess}")
if letter == guess:
display[p] = letter
if guess not in chosen_word:
Lives -= 1
print(display)
print(Lives)
if "_" not in display:
end_of_game = True
print("You won")
if Lives == 0:
end_of_game = True
print("You lost")
print (stages[Lives])