- 帖子
- 12
- 精华
- 0
- 积分
- 54
- 阅读权限
- 20
- 注册时间
- 2017-12-28
- 最后登录
- 2018-2-26
|
各路大神,小菜鸟先行礼了;
我在写这个点球游戏的时候,代码运行正常,但是运行的结果,我总觉得不对,又想不出来是哪里不对
劳驾各路大神帮小菜鸟指点一下,多谢多谢
附代码截图及源码
# -*- coding: utf-8 -*-
from random import choice
score = [0,0]
direction = ['L','R','C']
def kick():
print '========You kick========'
print 'Choice one side to shoot'
you = raw_input()
if you not in direction:
t0 = u'输入不合法,请重新输入'
print t0
else:
print 'you choice',''+ you
com = choice(direction)
print 'computer choice','' + com
if you!=com:
print u'恭喜你进球'
score[0] += 1
else:
print u'遗憾没有进球'
print 'Score:%d(you) - %d(com)\n' % (score[0],score[1])
print '========You save========'
print 'choice one side to save'
you = raw_input()
if you not in direction:
t1 = u'输入不合法,请重新输入'
print t1
else:
print 'you choice',''+ you
com = choice(direction)
print 'computer choice','' + com
if you==com:
print u'恭喜你守住了'
score[0] += 1
else:
print u'很遗憾,电脑进球了'
score[1] += 1
print 'Score:%d(you) - %d(com)\n' % (score[0],score[1])
for i in range(1):
print '========Round %d========' %(i+1)
kick()
while(score[0] == score[1]):
i += 1
print '========Round %d========' % (i+1)
kick()
if score[0] > score[1]:
print u'恭喜你,胜利了'
else:
print u'很遗憾,你输了'
print kick()
|
|