“”"
1.从控制台输入你要出的拳 —石头(1)/剪刀(2)/布(3)
2.电脑随即出拳
3.比较胜负
“”"
import random
a = random.randint(1,10)
print(a)
#1.从控制台输入要出的拳
player = int(input(‘请输入您要出的拳:石头1/剪刀2/布3:’))
#2.电脑出拳
computer = random.randint(1,3)
print(computer)
#3.比较胜负
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(‘玩家失败~’)