Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'stosswalkinator'
- # Reverse Guess the Number Game
- # Where the user chooses a number
- # and the computer tries to guess it
- import random
- import time
- print("Welcome to my Reverse Guess the Number game!")
- print("Where you choose the number and the computer will try and guess it!")
- print("Please enter your number between 1 and 100: ")
- userNum = int(input())
- computerNum = 50
- tries = 0
- while tries < 100:
- print(computerNum)
- if computerNum > userNum:
- print("That was too high!\n\n")
- tries += 1
- print(str(tries) + '\n\n')
- highNum = random.randint(1, 50)
- elif computerNum < userNum:
- print("That was too low!\n\n")
- tries += 1
- print(str(tries) + '\n\n')
- lowNum = random.randint(50, 100)
- else:
- print("Your number was " + str(userNum) + " !")
- print("I guessed it in " + str(tries) + " tries!")
- print(":)")
- computerNum = random.randint(1, 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement