Weird behaviour when running the script
<p>I started to code a guess the number type of game. When I execute the program, it either flows perfectly, either doesn't work...</p>

<pre><code>import random
from random import randint

print("Welcome to guess the number!\nDo you want to play the game?")

question = input("")

if question == "Yes".lower():
print("Sweet! Let`s begin!\nGuess the number between 1 and 10!")

    number = random.randint(1, 10)
    guess = int(input("Take a guess!\n"))

    if guess &gt; number:
        print("Your guess is too high")
        guess = int(input("Take a guess!\n"))

    if guess &lt; number:
        print("Your guess is too low")
        guess = int(input("Take a guess!\n"))

    if guess == number:
        print("Your guess was correct!")

elif question == "No".lower():
    print("Too bad! Bye!")
    quit()
</code></pre>

<p>I absolutely no idea whether it happens because of the code, or pycharm is to blame! </p>

<p>Changelog:</p>

<p>a) You do not need "import random" as you are importing randint on the line below it.</p>

<p>b) lower() is not in the right place as it will not work in inputs that are not all lowercase. It needs to be in the question variable</p>

<p>c) You use a while loop so that you keep asking for a guess until it is found</p>

<p>I guess the game works as it should like this:</p>

<pre><code>from random import randint

print("Welcome to guess the number!\nDo you want to play the game?")

question = input("").lower()

if question == "yes":
    print("Sweet! Let`s begin!\nGuess the number between 1 and 10!")

    number = randint(1, 10)
    guess = int(input("Take a guess!\n"))

    while guess != number:
        if guess &gt; number:
            print("Your guess is too high")

        if guess &lt; number:
            print("Your guess is too low")

        guess = int(input("Take a guess!\n"))
    else:
        print("Your guess was correct!")


else:
    print("Too bad! Bye!")
    quit()
</code></pre>

python pycharm