- 帖子
- 21
- 精华
- 0
- 积分
- 96
- 阅读权限
- 20
- 注册时间
- 2016-12-2
- 最后登录
- 2017-2-13
|
- from random import choice
- bifen = [0, 0]
- fangxiang = ['left','middle','right']
- def guocheng():
- print ' ==== now you kick ==== '
- print ' please choose one side to shoot '
- print ' left , middle , right '
- you = raw_input()
- print 'you kicked ' + you
- com = choice(fangxiang)
- print ' the other side saved ' + com
- if you != com:
- print ' he missed the ball , you win '
- bifen[0] += 1
- else:
- print ' he got the ball , you lose \n'
- print ' you - com\n %d -%d\n'%(bifen[0],bifen[1])
- print ' ==== now you save ===='
- print ' plese choose one side to save '
- print ' left , middle , right '
- you = raw_input()
- print ' you saved ' + you
- com = choice(fangxiang)
- print ' the other side kicked ' + com
- if you != com:
- print ' you missed the ball , you lose '
- bifen[1] += 1
- else:
- print ' you got the ball , you win '
- print ' you - com\n %d -%d\n'%(bifen[0],bifen[1])
- for i in range(5):
- print ' ==== round %d ==== '%( i +1 )
- guocheng()
- while bifen[0] == bifen[1]:
- i += 1
- print' round %d'%(i + 1 )
- guocheng()
- if bifen[0] >bifen[1]:
- print ' you win '
- else:
- print ' you lose '
-
复制代码 |
|