from random import *
number = randint(1, 100)
guess = int(input("Enter a guess: "))
while guess != number:
if guess > number:
print("Enter a smaller value")
else:
print("Enter a greater value")
guess = int(input("Enter a guess: "))
print("You guessed the number")This loop continues until we guess the number correctly. And after each guess, program directs us for the next guess (like enter smaller/greater number).
Sometimes, I get some inconsistency in the outputs. After I enter a wrong number as input, it should direct me with an output.
After I enter 40 as input, it does not show me the output as shown above. But after I enter the next input (42), it fixes the output screen and shows the missing output as below.
What might be the problem? It is happening all the time.