刚刚自学了 while/if–elif–else语法,所以想敲一个东西
也算是给自己找个练习本吧,hhhhh
写的不好的地方请大家见谅
和电脑玩猜拳小游戏
import random
tims=int(input('你要玩几局?'))
while tims:
person=int(input('请出拳:[0:石头 1:剪刀 2:布]'))
computer=random.randint(0,2)
if person==0 and computer==1:
print('厉害,你赢了')
pass
elif person==1 and computer==2:
print('厉害,你赢了')
pass
elif person==2 and computer==0:
print('厉害,你赢了')
pass
elif person==computer:
print('平手')
pass
else:
print('你输了')
pass
tims-=1
print('还剩下%s局'%tims)
因为刚开始学,肯定有考虑不到的地方,见谅!!!