Python Test
时间:2010-12-29 来源:chauncey
import random
number = random.randint(0,5)
#print number
def askTry():
tryInput =raw_input('Try again?:')
if(tryInput== 'yes'):
nextInput = raw_input('Try Input your number:')
newNumber = int(nextInput)
def tryInputNum():
if(newNumber == number):
print 'cool!!!'
if(newNumber < number):
print 'What are you doing ? Too small!!!难道你是白痴吗?'
askTry()
if(newNumber > number):
print 'What are you doing ? Too large!!!!难道你是傻子吗?'
askTry()
tryInputNum()
##########################
elif(tryInput != 'yes'):
print "OK,you will go...you should enter 'no'"
pass
##########################
inputNumber = raw_input('Please enter your number:')
if inputNumber =='':
print 'youmust enter a number......'
pass
if inputNumber !='':
nowNumber =int(inputNumber)
if(nowNumber == number ):
print 'You are great!!!'
elif(nowNumber <number):
print 'Too small!!!'
askTry()
elif(nowNumber > number):
print 'Too large!!!'
askTry()