Number guessing game, unable to take the next guess
<p>Here is the concept of my game, the computer randomly generates a number from 1-100 and the player has to guess that number. If the number they guess is higher or lower the computer tells them so.</p>

<p>I added some code to make sure that the guess that the user enters is a number, but for some reason, it only works for their first guess. </p>

<pre><code>import random

x = random.randint(1, 100)
guess = input("Guess the number")

while guess.isnumeric() == True:

    if x &gt; int(guess):
        print("Too low, guess again")
        guess = input("Guess the number")

    if x &lt; int(guess):
        print("Too high, guess again")
        guess = input("Guess the number")

    if x == int(guess):
        print ("That is correct!")
        break

if guess.isnumeric() == False:
        print("Please enter a valid number")
        guess = input("Guess the number")
</code></pre>

<p>I don't really know how to else to explain it. But for example, if I guess the number 20 as my first guess, it would output too high or too low depending on the randomly generated number, but after that, if I input a bunch of random letters it would give me an error that the guess could not be compared to the randomly generated number.</p>

<p>You need to surround your guessing logic in another loop that continues until the guess is correct.</p>

<p>pseudocode:</p>

<pre><code>choose_target_answer
while player_has_not_guessed_answer
    get_player_guess
    if player_guess_is_valid
        respond_to_player_guess
    else
        give_error_message
</code></pre>

python random