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

相关推荐
xh didida5 分钟前
C++ -- string
开发语言·c++·stl·sring
码喽7号9 分钟前
vue学习四:Axios网络请求
前端·vue.js·学习
星幻元宇VR16 分钟前
VR科普行走平台适用哪些科普教育主题
科技·学习·安全·vr·虚拟现实
humors22121 分钟前
各厂商工具包网址
java·数据库·python·华为·sdk·苹果·工具包
lly20240629 分钟前
Bootstrap 折叠组件详解
开发语言
无限进步_31 分钟前
【C++&string】大数相乘算法详解:从字符串加法到乘法实现
java·开发语言·c++·git·算法·github·visual studio
xinzheng新政44 分钟前
Javascript 深入学习基础·4
javascript·学习·servlet
pzx_0011 小时前
【优化器】 随机梯度下降 SGD 详解
人工智能·python·算法
‎ദ്ദിᵔ.˛.ᵔ₎1 小时前
模板template
开发语言·c++
大邳草民1 小时前
Python 中 global 与 nonlocal 的语义与机制
开发语言·笔记·python