View Single Post
Old Jan 20th, 2008, 6:52 PM   #6
Chuckiferd
Programmer
 
Join Date: Nov 2007
Posts: 64
Rep Power: 1 Chuckiferd is on a distinguished road
Re: My pyguessinggame

I am attempting to write the program from scratch right here on the computer

#guessgame********** (1/20/08)
from whrandom import randint
def start():
   answer=randint(1,101) #the answer
   guessnum=1 #number of failed user guesses
   guess=raw_imput('''I am thinking of a number that is in between 1 and 100''')#the current guess of the user
   while guess != answer:
      guessnum=guessnum+1
      if guess > 100
         print '''that guess is way too high, the answer has to be 100 or lower''' 
         guess=raw_imput('guess again please, within the limit this time')
      elif guess = 0
         print 'actually zero is not within the 1-100 range'
         guess=raw_imput('guess again please')
     elif guess < 0
         print 'are you testing me?'
         guess=raw_imput(guess again, in the positives please')
      elif guess > 0 and guess < 100 and guess < answer
         print 'that guess is below the answer'
         guess=raw_imput('try guessing again')
      elif guess >0 and guess < 100 and guess > answer
         print 'guess lower, your answer is to high'
         guess=raw_imput('try once more')
      elif guess == answer
         print 'congratualtions, that took', guessnum, 'tries'
      #would I need a 'break command here? or maybe a 'sys.exit()'
new_line
#I still don't understand this part.....
if __name__ == '__main__':
   start()
   print
   raw_input('press return')
else:
   print 'Module guessgame imported'
   print 'to run, type:guessgame.start()'
   print 'to refresh, type:reload (guessgame)'
#--------------------------------------------------------------------
#.....to this part, please explain, I copied it out of another program, 
#simply switching out 'warmer' and 'run' with 'guessgame' and 'start'
#--------------------------------------------------------------------
#end game
__________________
There are 10 kinds of people in this world, those who can read binary and those who can't.

Last edited by Chuckiferd; Jan 20th, 2008 at 7:10 PM.
Chuckiferd is offline   Reply With Quote