import random
people=int(input("输入要出什么(填数字),石头(1)/剪刀(2)/布(3):"))
computer=random.randint(1,3)
print("你出的是%d-电脑出的是%d"%(people,computer))
if((people==1 and computer==3)
or(people==2 and computer==3)
or(people==3 and computer==2)
):
print("你赢了")
elif people==computer:
print("打成平手啦")
else:print("你输了")
结果举例:
输入要出什么(填数字),石头(1)/剪刀(2)/布(3):2
你出的是2-电脑出的是3
你赢了