Good morning, I've been trying to make a mini game, where I enter the words in the WORDS variable and the same type the name randomly, so far Ok. But I wanted to change and I can not do what I want because I can not find a way to do the same. (I started studying programming last weekend). Here is the code:
import random
WORDS = ("palavra1", "palavra2", "palavra3")
word = random.choice(WORDS)
correct = word
champions = ""
while word:
position = random.randrange(len(word))
champions += word[position]
word = word[:position] + word[(position + 1):]
print("")
print("A palavra é:", champions)
guess = input("Nome: ")
while guess != correct and guess != "":
print("Essa não é a palavra")
guess = input("A palavra é: ")
if guess == correct:
print("Você acertou\n")
input("\n\nPressione Enter para sair. Versão 1.0")
What I wanted to change, I tried to make the result of the variable "word" pull a hint from a list and insert this hint after the person makes a mistake.
palavra1 = ["dica1","dica2","dica3"]
palavra2 = ["dica1","dica2","dica3"]
palavra3 = ["dica1","dica2","dica3"]
Example: print ("This is not the word") print ("Tip:", hint1, ".")
I guess it was confusing, but I think you can understand it.