第一个 Python 程序

猜名字,猜出中午请你吃饭!

print '==== Guess Who am I ===='
print '                 by:yichou\n\n\n'

print 'Hello let\'s play a game!'
print 'I give 10 times to guess my name'
print 'Come on win your dinner!\n'



name = raw_input('pleast input my name:\n')
count = 0
while not name.endswith('yichou'):
    name = raw_input('nonono, retry:\n')
    count += 1
    if(count == 1):
        print 'the first word is \'y\''
    elif (count == 2):
        print 'the second word is \'i\''
    elif(count > 10):        
        break

if(count > 10):
    print 'you are so stupid!'
    print 'you have guessed', count, 'tims'
    print 'my name is ' + 'yichou'
else:
    print 'you win! congratulations !'

 

posted @ 2013-09-04 11:02  野生奥特曼2号  阅读(260)  评论(0编辑  收藏  举报