I have the following basic code in Google Colab:
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.
<https://lh3.googleusercontent.com/-dRXvfUG6-Ec/W2IoGA2A4LI/AAAAAAAACGo/cU9p-dscUm0mTj3YI_pifrz3cYsn0vZtQCLcBGAs/s1600/2018-08-02_00-13-49.png>
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.
<https://lh3.googleusercontent.com/-w-7UwWOAaKE/W2IoOMySKlI/AAAAAAAACGs/j566bUg2kuANNjQ3IpBMSp7iGle9pilywCLcBGAs/s1600/2018-08-02_00-14-42.png>
What might be the problem? It is happening all the time.
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/6076f165-f283-4580-9dc0-8501ee0ffc5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.