I need some help with this little game. The question is this, the game I've already done and it's working perfectly, what I really need is loop with While .
I can not find the error, as long as the user does not hit the value I need the game to continue until I reach the fifth attempt, though mine is not running while while and I can not understand why .
The following is the code below:
from random import randint
def acertou():
n = randint(1,11)
x = 0
print(n)
while (x < 5):
x = x + 1
y = int(input("Digite um número "))
if n == y:
return "Parabéns,você acertou!"
break
elif y > n:
return "Opa,o número que você escolheu é maior que o sorteado!"
return "Opa,o número que você escolheu é menor que o sorteado!"