great, no more bugs..... now how do I run it? obviously the instructions given by several tutorials "$ python
name of program" doesn't work on windows.
Here is the finished product, completely debugged,
#guessgame********** (1/20/08)
from random import randint
def start():
answer=randint(1,101) #the answer
guessnum=0 #number of 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')
if guess == answer:
print 'congratualtions, that took', guessnum, 'tries'
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)'
#end game
raw_imput('press enter to quit')