IT & IoT Security | Cloud | It's all about the life itself

Nothing in life is as important as you think it is, while you are thinking about it.

Python – guess hidden number

Hi, I am sure there are numerous way to solve this. Here is a way:

import random

while keepPlaying == "y":
    print("Game start!")
    hiddenNumber = random.randint(1,100)
    while not userGuess == hiddenNumber:
        userGuess = int(input("Guess a number:"))
        if userGuess > hiddenNumber:
            print("Too high")
        elif userGuess < hiddenNumber:
            print("Too low")
            print("That's right")
    keepPlaying = input("Play again ? y or n")