猫史档案馆


【Python作品分享】新的作品-5-副本【教程贴】

用户:我要做吃鸡我要做吃鸡查看:0 回复:0 评论:0 创建时间:2019-12-30T17:29:53


【作品展示】

center_image

 

【作品介绍】

石头剪刀布

 

【作品源代码】

player=input("请输入你要出的是剪刀(j),石头(s),还是布(b):")
print(player)
import random

playerPc=random.randint(1,3)

if playerPc==1:
    playerPc="j"
    msj="剪刀(j)"

if playerPc==2:
    playerPc="s"
    msj="石头(s)"

if playerPc==3:
    playerPc="b"
    msj="布(b)"

print("电脑输出的是"+msj)

if player=="s" and playerPc=="j":
    print("玩家胜利")
if player == "b" and playerPc =="s": 
    print("玩家胜利")
if player == "j" and playerPc == "b":
    print("玩家胜利")
if player == "j" and playerPc == "s":
    print("计算机胜利")
if player == "s" and playerPc =="b": 
    print("计算机胜利")
if player == "b" and playerPc =="j": 
    print("计算机胜利")
if player==playerPc:
    print("平局哦,再战一局")




























 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页