Python 中出现 invalid syntax, 求解求原因🙏💰 20
在Mac上面用Python3.6.5编了一个点球小游戏,跟书上面的一模一样,为什么就不能执行呢?Python入门新手,高手们帮忙看看呗😊勿喷无嘲笑...
在Mac上面用Python3.6.5 编了一个点球小游戏,跟书上面的一模一样,为什么就不能执行呢?Python入门新手,高手们帮忙看看呗😊勿喷无嘲笑😭
下面是编的内容👋
from random import choice
(score)=(0,0)
(direction)=['left','center','right']
def kick():
print ('====You kick!====')
print ('Choose one side to shoot:')
print ('left,center,right')
(you)=input()
print ('You kicked'+(you))
(com)=choice(direction)
print ('Computer saved '+(com))
if (you) !=(com):
print ('Goal')
(score[0])=(score[0])+1
else:
print('Oops...')
print ('Score:%d(you) - %d(com)\n'%((score[0]),(score[1]))
print ('====You save!====')
print ('Choose one side to save:')
print ('left,center,right')
(you)=input()
print ('You saved'+(you))
(com)=choice(direction)
print ('Computer kicked '+(com))
if (you)==(com):
print ('Goal')
else:
print ('Oops')
(score[1])=(score[1])+1
print ('Score:%d(you) - %d(com)\n'%(score_you,score_com))
for (i) in range(1):
print ('====Round %d===='%(i)+1)
(kick())
while(score[0]==score[1]:
(i)+=1
print ('====Round %d===='%((i)+1)
(kick())
print ('====Final score:%d(you) - %d(com)====\n'%((score[0]),(score[1]))
if (score[0]) > (score[1]):
print ('You Win')
else:
print ('You Lose') 展开
下面是编的内容👋
from random import choice
(score)=(0,0)
(direction)=['left','center','right']
def kick():
print ('====You kick!====')
print ('Choose one side to shoot:')
print ('left,center,right')
(you)=input()
print ('You kicked'+(you))
(com)=choice(direction)
print ('Computer saved '+(com))
if (you) !=(com):
print ('Goal')
(score[0])=(score[0])+1
else:
print('Oops...')
print ('Score:%d(you) - %d(com)\n'%((score[0]),(score[1]))
print ('====You save!====')
print ('Choose one side to save:')
print ('left,center,right')
(you)=input()
print ('You saved'+(you))
(com)=choice(direction)
print ('Computer kicked '+(com))
if (you)==(com):
print ('Goal')
else:
print ('Oops')
(score[1])=(score[1])+1
print ('Score:%d(you) - %d(com)\n'%(score_you,score_com))
for (i) in range(1):
print ('====Round %d===='%(i)+1)
(kick())
while(score[0]==score[1]:
(i)+=1
print ('====Round %d===='%((i)+1)
(kick())
print ('====Final score:%d(you) - %d(com)====\n'%((score[0]),(score[1]))
if (score[0]) > (score[1]):
print ('You Win')
else:
print ('You Lose') 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询