In [12]:
from IPython.display import clear_output
from random import randint

####Variables###
totalmatches = 0
totalWins = 0
g = randint(0,1000) #the number the bot is guessing 

####Functions###
def game():
    global attempts
    attempts = 1
    print("Good luck getting this one NEWBIE")

    while attempts <= 10:
        guess = int(input(f"Attempt #{attempts}: Start guessing! "))
        
        if guess == g:
            print(f"You win this time! The correct number was {g}.") #when you get it correct
            return
        elif guess < g:
            print("Haha!, the number is greater than this one.") 
        elif guess > g:
            print("Heh..., the number is Less than this one.")
        
        attempts += 1 #the amount of attempts each turn

    print(f"HAHAHA! I won, the answer I hold is {g}. Better luck next time!") #When you fail, this message will pop up 

game()
Good luck getting this one NEWBIE
Heh..., the number is Less than this one.
Haha!, the number is greater than this one.
Heh..., the number is Less than this one.
Heh..., the number is Less than this one.
Haha!, the number is greater than this one.
Haha!, the number is greater than this one.
Haha!, the number is greater than this one.
Heh..., the number is Less than this one.
You win this time! The correct number was 721.
In [ ]: