zmw-1997
#-*- cording: utf-8 -*-
from random import randint
player = int(input("0为剪刀 1为拳头 2为布"))
computer = randint(0,2)

if (player == "0" and computer == "2") or (player == "1" and computer =="0") or (player == "2" and computer == "0"):
    print("你赢了")
elif player == computer:
    print("平局")
else:
    print("你输了!")

random模块中randint的用法是()中输入数字,会随机出现其中的数字。

分类:

技术点:

相关文章:

  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
  • 2022-12-23
  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
猜你喜欢
  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
  • 2021-09-05
相关资源
相似解决方案