Python学习——猜拳小游戏

import random

player = int(input("请输入:剪刀 0,石头 1,布2"))

computer = random.randint(0,2)# print("玩家输入的是%d,电脑输入的是%d" %(player,computer)) 用于测试

if (player == 0) and (computer == 0) or (player == 1) and (computer == 1) or (player == 2) and (computer == 2):

print("平局,继续决战到天亮")

elif (player == 0) and (computer == 1) or (player == 1) and (computer == 2) or (player == 2) and (computer == 1):

print ("输了,要加油")

else:

print ("赢了,太厉害")

相关推荐
HyperAI超神经3 小时前
在线教程丨 David Baker 团队开源 RFdiffusion3,实现全原子蛋白质设计的生成式突破
人工智能·深度学习·学习·机器学习·ai·cpu·gpu
Tony Bai6 小时前
高并发后端:坚守 Go,还是拥抱 Rust?
开发语言·后端·golang·rust
wjs20246 小时前
Swift 类型转换
开发语言
秃了也弱了。6 小时前
python实现定时任务:schedule库、APScheduler库
开发语言·python
YJlio7 小时前
VolumeID 学习笔记(13.10):卷序列号修改与资产标识管理实战
windows·笔记·学习
Dfreedom.7 小时前
从 model(x) 到__call__:解密深度学习框架的设计基石
人工智能·pytorch·python·深度学习·call
weixin_440730507 小时前
java数组整理笔记
java·开发语言·笔记
小龙7 小时前
【学习笔记】多标签交叉熵损失的原理
笔记·学习·多标签交叉熵损失
weixin_425023007 小时前
Spring Boot 配置文件优先级详解
spring boot·后端·python
Thera7777 小时前
状态机(State Machine)详解:原理、优缺点与 C++ 实战示例
开发语言·c++