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
|
mots = [
"BONJOUR",
"ORDINATEUR",
"CLAVIER",
"SOURIS",
"CHEVAL",
"OISEAU",
"CHIEN"
]
mot = choix(mots)
saisi = ["_"] * taille(mot)
essais = 10
while True:
if essais <= 0:
print("Vous avez perdu !")
print("Le mot était : " + mot)
break
print(" ".join(saisi))
if saisi == list(mot):
print("Vous avez gagné !")
break
print("%d essais restants" % essais)
lettre = maju(input("? "))
for i in range(taille(mot)):
if mot[i] == lettre:
saisi[i] = lettre
if lettre not in mot:
essais -= 1
print(" ")
|