Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Game in which computer guess your number
- #coded by atul4c
- import os
- import random
- while 1 > 0:
- os.system('cls' if os.name == 'nt' else 'clear')
- print("\nHey in this game you have to guess a number and the computer tries to guess it")
- pguess = int(raw_input("\nGive a number between 1-10000:"))
- cguess = random.randrange(10000) + 1
- print("guess number:" + str(cguess))
- tries = 1
- while pguess != cguess:
- cguess = random.randrange(10000) + 1
- os.system('cls' if os.name == 'nt' else 'clear')
- print("\n\n\n\t\tCracking the number:" + str(cguess))
- tries = tries+1
- print ("\nThe computer guessed your number in these many attempts:" + str(tries))
- dump = raw_input("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement