#""" #------------------------------------------------- # Project: Take-Away Game # Standard: 91883 (AS1.7) v.1 # School: Tauranga Boys' College # Author: phoenix ruddell # Date: THE DATE YOU COMPLETED THE CODE # Python: 3.5 #------------------------------------------------- #""" #import libraries import random import time # varible sets reset_guesses = 0 user_score = 0 rounds = 0 ai_score = 0 round_won = True rounds = 0 guess_count = 0 print("Guess The Number") time.sleep(1) # Name and game intro player_name = input("What Is Your Name? ") time.sleep(0.5) print("Welcome to, Guess The Number " + player_name) time.sleep(2) print("In this game you will have to guess which number the Ai is thinking of, you only have 10 guesses to figure out what the number is, if you guess it in under 10 trys you move on to the next round, if you use up all of your guess then you lose. ") time.sleep(10) while True: try: print() rounds = int(input("select the amount of rounds that you would like to play, between 3 & 7. . . ".format(player_name))) if rounds < 3 or rounds > 7 : print() print("Please select an amount between 3 & 7 ") else: break except: print() print("Thats not a number, or an amount of rounds you can select, try again") time.sleep(1) print("The AI has chosen a number between 1 & 15, guess wisely ") time.sleep(1) n = random.randrange(1,15) guess = int(input("Enter your guess: ")) while n!= guess: guess_count += 1 if guess < n: print("Too low") guess = int(input("Guess again: ")) elif guess > n: print("Too high") guess = int(input("Enter number again: ")) else: break print("you guessed it right! With {} tries".format(guess_count)) max_attempts = 10 guess_count = 0 while n!= guess and guess_count < max_attempts: guess_count += 1 if guess_count == max_attempts: print("Out of guesses, the number the AI choose was {}.".format(n)) else: break