#---------------------------------------------------------------------------------------------------------- # File name: Guess the number # author: Shaun Zeldenrust # purpose: 11DGT # Date: 13th march 2024 # School: Tauranga Boys Collage #copyright@ Shaun Zeldenrust 2024 #---------------------------------------------------------------------------------------------------------- import random import time reset_guesses=0 rounds=0 user_score=0 AI_score=0 roundscore=1 print("Guess A Number ") print() # Explaning how to play name=input("What is your name? ") print("Hello", name, "welcome to Guess a number, Im going to think of a number and you have to guess what number im thinking of within 10 attempts" ) time.sleep(3) print("After your guess I will either say Higher or Lower depending on your guess") time.sleep(3) print("if you guess correctly you get a point, if you run out of attempts I get a point, best out of 3 rounds") print() #Round loop while rounds <= 3: number=random.randint(1,1000) round_win=False guesses= 10 if guesses==0 : break if round_win == True : rounds = rounds + 1 if rounds == 1 : guesses=reset_guesses print("New round") while guesses >0 : Guess=int(input("Whats your guess? ")) if Guess == number : print("Correct the number was", number) round_win=True break if number < Guess : print() print("Lower") guesses-= 1 print(guesses, "guesses left") elif number > Guess : print() print("Higher") guesses-= 1 print( guesses, "guesses left")