1
The code in question is the bottom one, a lot of it I’m understanding more the loop for confused me, it gets the sequence of the variable, but in print, it informs exactly the sequence that the user typed, as he knows which is the "letter" in the variable index ?
def jogar():
print("******************************")
print("**BEM VINDO AO JOGO DA FORCA**")
print("******************************")
palavra_secreta = "brasil"
while True:
chute = input("Qual a letra? ")
chute = chute.strip()
index = 0
for i in palavra_secreta:
if(chute.upper() == i.upper()):
print("Encontrada sua letra {} na posição {}".format(chute.upper(), index))
index = index + 1
if(__name__ == "__main__"):
jogar()
A string is an iterator, you can see that as a string is an array/list: https://repl.it/repls/TruthfulBusyFanworms
– Miguel