### Number Guessing Game: Human Does the Guessing. from random import randint # import a special function from library from math import log n = randint(1,1024) # generate random integer between 1 and 1024 (inclusive) # this is the number that the human will try to guess g = -1 # this variable will hold the human's guess, -1 so initially n != g c = 0 # counts how many tries it took the stupid human to guess n guessed = [] # records guesses made, see if this human is stupid enough to guess the same number twice print "My number is between 1 and 1024, let's see how many tries it will take for you to guess it." while n != g: # stop loop when the human finally guesses it g = input("Enter your guess:") c += 1 # record guess if (n!=g): # wrong guess if (g in guessed): print "You guessed that already, moron!" else: guessed.append(g) # else record guess if (g 10: print "But you're still just a stupid human."