import time
import random
def play_game():
    good=0
    print("select game mode : casual/challenge")
    gamemode=input()
    count=0
    if gamemode=="casual":
        count=1
    print("select number for game size:")
    size=int(input())
    print("very well")
    time.sleep(1)
    print("the computer is selecting a number")
    time.sleep(1)
    for i in range(3):
        print(".",end="")
        time.sleep(1)
    print()
    print("the computer has selected a number")
    guess=random.randint(1, size)
    time.sleep(1)
    print("the game will start momentaraly")
    for i in range(3):
        print(".",end="")
        time.sleep(1)
    print()
    print("the game has started")
    time.sleep(1)
    guessed=0
    lose=0
    while good==0:
        print("guess:")
        nbguess=int(input())
        if count==0:
            guessed += 1
            print("you guessed",end=" ")
            print(guessed,end=" ")
            print("times")
            if guessed==10:
                lose=1
                good=1
            time.sleep(1)
        if nbguess==guess:
            good=1
        elif nbguess<guess:
            print("your guess is smaller than the computer's number ")
        else:
            print("your guess is higher than the computer's number ")
    if lose==1:
        print("you guessed too much times, YOU LOSE")
    else:
        print("YOU WIN")
    print("replay: yes/no")
    replay = input().lower()

    if replay == "yes":
        good = 0
        lose = 0
        guessed = 0
        count = 0
        play_game()
    else:
        print("Thanks for playing!")
play_game()

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: