- import os
- import time
- import sys
- print "This game can guess the age autamaticlly"
- os.system("pause")
- print "Please think about a number which is your best friend's age. Assuming it is \\'a\\'"
- os.system("pause")
- print "Think about a number from 1 to 8. Assuming it is \\'b\\'"
- os.system("pause")
- print "multiply the number (b) by 9. "
- os.system("pause")
- print "add it to the age. Assuming it is \\'d\\': d=a+b*9"
- os.system("pause")
- print "Input the answer------ps: input \\'d\\'"
- answer = input()
- print "I'm guessing "
- print "wait for five seconds please"
- time.sleep(1)
- os.system("cls")
- for num in range(5 , 0 , -1):
- print num
- time.sleep(1)
- os.system("cls")
- print "The age is ..."
- time.sleep(2)
- sum = ( answer / 10 ) + ( answer % 10 )
- if sum > 10:
- sum = ( sum / 10 ) + ( sum % 10 )
- number = 0
- a = 1
- b = 2
- flag = 0
- for digit in range(3 , 10):
- if digit + a == sum :
- number = digit
- flag = 1
- break
- if flag == 0:
- for digit2 in range(0 , 6):
- if digit2 + b == sum:
- number = digit2
- flag = 2
- break
- if flag == 0:
- print "Your best friend might have been married!!!Or he or she is just a baby!!!----???"
- else:
- answers = flag * 10 + number
- print answers
- print "Y / N ?"
- print "input Y or N , please"
- str = raw_input()
- if str == 'Y' or str == 'y':
- print "haha\\n^_^"
- if str == 'N' or str == 'n':
- print """555...\\n-.-\\n.\\n.\\n.\\n.\\n.\\n-.-\\n555..."""
- time.sleep(1)
- os.system("pause")
- #该片段来自于http://www.codesnippet.cn/detail/011120136890.html
来源: http://www.codesnippet.cn/detail/011120136890.html