Well I have the game and I do not know how to do that in the variables ( tupalabra
and palabra
) I choose the list that I created from random words in order to start playing. Because I have them empty and it shows me that I have already won directly and I can not find a way ...
That's what I have and I do not know how to face it ..
import time
nombre=input("¿Como te llamas? ")
print(" ")
print("hola, "+nombre," Es hora de jugar al ahorcado pequeño bolon")
print (" ")
print("hola, ", nombre, " Es hora de jugar al ahorcado pequeño bolon")
print("\n", "\n", "\n", "\n")
time.sleep(1)
print("Comienza a adivinar ")
time.sleep(0.5)
tupalabra=''
palabra=''
vidas=5
import random
with open('archisofi.txt', 'r') as d:
lineas = [linea.split() for linea in d]
for linea in lineas:
print(linea)
print(random.choice(linea))
while vidas > 0:
fallas=0
for letra in palabra:
if letra in tupalabra:
print(letra,end="")
else:
print("*",end="")
fallas+=1
if fallas==0:
print("")
print("Felicidadades ganaste, buen trabajo")
break
tuletra=input("Introduce una letra: ")
tupalabra+=tuletra
if tuletra not in palabra:
vidas-=1
print("Equivocacion")
print("Tu tienes ",+vidas," vidas")
if vidas == 0:
print("Perdiste!")
else:
print("Gracias por participar")