#!/usr/bin/python import random ''' Random number guessing game. Just made because I was bored. :p Number is randomly generated from between 1 and 100. Made by nu11byte. A lot of un-needed crap, but I was just having a play. Just refreshing my mind. Parts of Python have been forgot and left behind for other languages syntax. Luckily Python's syntax is quite similar to other languages. ''' #Use and edit this as you wish. def cls(): print ''' ______ _ (_____ \ _ | | _____) ) _| |_ | | _ ___ ____ | ____/ | | | _)| || \ / _ \| _ \ | | | |_| | |__| | | | |_| | | | | |_| \__ |\___)_| |_|\___/|_| |_| (____/ ''' print "\n" cls() print "Guess what number I am thinking of. My number is between 1 and 100." def main(): randomNumber = random.randint(1,100) userGuess = 0 guessCount = 0 while (userGuess!=randomNumber): userGuess = int(input("Guess: ")) guessCount += 1 if (userGuess < randomNumber): print "Guess a little higher." elif (userGuess > randomNumber): print "Guess a little lower." else: print "It took you %d goes to correctly guess the number." % guessCount pause = raw_input("Play again? (y/n): "); if (pause == "y"): userGuess = 0 guessCount = 0 randomNumber = random.randint(1,100) cls() main() ###EOF