Python笔记-5 石头剪刀布

import random
#random 函数,导入随机数
#random.randint(a,b)  生成[a,b]的随机整数

player = int(input('请输入 (0)剪刀 (1)石头 (2)布'))
print('用户输入的是',player)

computer = random.randint(0,2)
print('电脑出的是',computer)
if (player == 0 and computer == 2) or (player == 1 and computer == 0) or (player == 2 and computer == 1):
    print('恭喜你,你赢了!')
elif player == computer:
    print('平局')
else:
    print('你个垃圾')
上一篇:建造者模式(Builder Pattern)


下一篇:Fusion computer安装问题