python---4
# 石头剪刀布
player=int(input("请玩家出拳 (1)石头/(2)剪刀/(3)布:"))
computer=1
print("玩家出的拳是%d,电脑出的拳是%d" %(player,computer))
if player==3:
print("玩家获胜")
elif player==1:
print("平局")
else:
print("电脑获胜")
import random #随机返回a,b范围内的整数 random.randint(a,b)
# 石头剪刀布
import random
player=int(input("请玩家出拳 (1)石头/(2)剪刀/(3)布:"))
computer=random.randint(1,3)
print("玩家出的拳是%d,电脑出的拳是%d" %(player,computer))
if ((player==1 and computer==2)
or (player==2 and computer==3)
or (player==3 and computer==1)) :
print("玩家获胜")
elif player==computer:
print("平局")
else:
print("电脑获胜")