python3小游戏源代码_python 点球小游戏代码

#点球小游戏

from random import choice

import time

score=[0,0]

direction = ['left','center','right']

def kick():

print('====You Kick !====' )

time.sleep(1)

print ( 'Choose one side to shoot: ')

time.sleep(1)

print ( 'left,center,right')

time.sleep(1)

you = input()

print ('you kicked ' + you)

time.sleep(1)

com=choice(direction)

print('Computer saved '+com)

time.sleep(1)

if you != com:

print('Goal!')

time.sleep(1)

score[0] +=1

else:

print('Oops..')

time.sleep(1)

print('Score:%d(you) - %d(com) \n'%(score[0],score[1]))

time.sleep(1)

print('==== You Save !====' )

time.sleep(1)

print ( 'Choose one side to save: ')

time.sleep(1)

print ( 'left,center,right')

time.sleep(1)

you = input()

print ('you saved ' +you)

time.sleep(1)

com=choice(direction)

print('Computer Kicked '+com)

time.sleep(1)

if you == com:

print('Saved!')

time.sleep(1)

else:

print('Oops..')

time.sleep(1)

score[1] +=1

print('Score:%d(you) - %d(com) \n'%(score[0],score[1]))

time.sleep(1)

for i in range(5):

print('====Round %d ===='%(i+1))

time.sleep(1)

kick()

while(score[0]==score[1]):

i+=1

print('===Round %d ===='%(i+1))

time.sleep(1)

kick()

if score[0] &gt score[1]:

print('YoU Win !')

else:

print('You Lose !')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值