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 ("赢了,太厉害")

相关推荐
闲人编程32 分钟前
自动化文件管理:分类、重命名和备份
python·microsoft·分类·自动化·备份·重命名·自动化文件分类
沐知全栈开发1 小时前
Python3 集合
开发语言
微露清风1 小时前
系统性学习C++-第八讲-vector类
java·c++·学习
Jonathan Star1 小时前
用Python轻松提取视频音频并去除静音片段
开发语言·python·音视频
月临水2 小时前
Git 学习笔记
笔记·git·学习·1024程序员节
Evand J2 小时前
【自适应粒子滤波MATLAB例程】Sage Husa自适应粒子滤波,用于克服初始Q和R不准确的问题,一维非线性滤波。附下载链接
开发语言·matlab·卡尔曼滤波·自适应滤波·非线性
奋斗的牛马2 小时前
FPGA—ZYNQ学习Debug(三)
学习·fpga开发
qq_401700412 小时前
matlab学习
学习·算法·matlab
hd51cc2 小时前
C++ 类的学习(四) 继承
开发语言·c++·学习
编码追梦人2 小时前
深耕 Rust:核心技术解析、生态实践与高性能开发指南
开发语言·后端·rust