Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Incremento do código com 'while'

Usando while e 'string interpolation'.

# Simple guessing game: introduction to Python and PyCharm

print("*********************")
print("Let's start our game!")
print("*********************")

print("Try to guess what the secret number is. It's between 1 and 99")
secret_number = 42
total_attempt = 3
attempt_count = 1

while attempt_count <= total_attempt:
    print("Attempt {} of {}".format(attempt_count, total_attempt))
    kick = input("Enter your number: ") # The input receives the value as a string.
    attempt = int(kick) # Now, it's necessary to pass from 'str' to 'int'.
    print("You typed: ", attempt) # to compare with 'secret_number', which is also 'int'.

    you_hit = attempt == secret_number
    bigger_hit = attempt > secret_number
    lower_hit = attempt < secret_number

    if you_hit:
        print("You got it right, {} is the secret number!".format(kick))
    else:
        if bigger_hit:
            print("You failed, your number was bigger than secret number!")
        elif lower_hit:
            print("You failed, your number was lower than secret number!")

    attempt_count += 1

print("End Game")
1 resposta
solução!

Opa, Eliezer! É isso ai! Agora é seguir em frente com os estudos!

Sempre que precisar de alguma ajuda é só mandar aqui no fórum da Alura!

Grande abraço e bons estudos, meu aluno!