import random import time round = 1 psco = 0 csco = 0 while True: name = input("What is your name: ") if name.isalpha() == True: break else: print("sorry but that name is inapropriate, please try again") print("Hello ", name, ", Welcome to the guessing game") print(" ") print("The rules are simple") time.sleep(0.7) print(" ") print("If your guess is too low the computer will say 'higher'") time.sleep(0.7) print(" ") print("and if your guess is too high the computer will say 'lower'") while True: if psco or csco == 2: break print(" ") play = input("Do you want to play? (y/n): ") if play.lower() != "y": break answer = random.randint(1, 1000) guessa = 10 print(" ") print("Round", round) while guessa > 0: while True: try: guess = int(input("pick a number between 1 - 1000: ")) if guess < 1 or guess > 1000: print("A NUMBER BETWEEN 1 - 1000") time.sleep(0.5) print("NO, IT ISINT!") print("TRY AGAIN") else: break except: print("NUMBER, IT CLEARLY SAID NUMBER") time.sleep(0.3) print("TRY AGAIN!") #guess checker if guess == answer: print(" ") print("You are correct!") print(" ") psco += 1 break elif guess > answer: print(" ") print("Lower") print(" ") else: print(" ") print("Higher") print(" ") if psco or csco == 2: print(" ") print("the game has completed") print(" ") break guessa -= 1 if guessa == 0: print("you lose this round") print("the answer was, ", answer) print(" ") csco = csco + 1 round = round + 1 break #end of game frases print(" ") print("Game Over") print("Your score is, ", psco," the computers score is, ", csco) if psco > csco: print(" ") print("Congratulations! You beat the computer!") elif psco == csco: print(" ") print("It's a tie!") else: print(" ") print("Better luck next time!")