-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathahorcado.py
More file actions
72 lines (68 loc) · 2.13 KB
/
ahorcado.py
File metadata and controls
72 lines (68 loc) · 2.13 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<<<<<<< HEAD
import random
list = ["casa", "perro", "computadora", "television", "papa"]
health = 3
play_again = "y"
word = random.choice(list)
word_sep = []
for i in word:
word_sep.append(i)
print(f"The word has {len(word_sep)} letters")
while health > 0 and play_again.lower() == "y":
player = input("Letra: ")
if player in word_sep:
count = word_sep.count(player)
for x in range(count):
word_sep.remove(player)
print(f"Correct, {player} is in the word")
else:
print(f"Incorrect, {player} not in the word\nLifes {health - 1}")
health -= 1
if health == 0:
print(f"¡GAME OVER! The word was {word}")
if len(word_sep) == 0 and health > 0:
health = 3
print(f"Congratulations, the word was {word}")
word_sep.clear()
word = random.choice(list)
word_sep = []
for i in word:
word_sep.append(i)
play_again = input("Do you want to play again? (Y/N): ")
if play_again.lower() != "y":
break
=======
import random
list = ["casa", "perro", "computadora", "television", "papa"]
health = 3
play_again = "y"
word = random.choice(list)
word_sep = []
for i in word:
word_sep.append(i)
print(f"The word has {len(word_sep)} letters")
while health > 0 and play_again.lower() == "y":
player = input("Letra: ")
if player in word_sep:
count = word_sep.count(player)
for x in range(count):
word_sep.remove(player)
print(f"Correct, {player} is in the word")
else:
print(f"Incorrect, {player} not in the word\nLifes {health - 1}")
health -= 1
if health == 0:
print(f"¡GAME OVER! The word was {word}")
if len(word_sep) == 0 and health > 0:
health = 3
print(f"Congratulations, the word was {word}")
word_sep.clear()
word = random.choice(list)
word_sep = []
for i in word:
word_sep.append(i)
play_again = input("Do you want to play again? (Y/N): ")
if play_again.lower() != "y":
break
>>>>>>> 96f5d926279ccd9ff9ba6df31e8d9784ac34c00e
print(word_sep)