From 2da8a3768ce62a8de342db338e698707ccb46e18 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 30 Apr 2022 14:44:16 +0800 Subject: [PATCH] save project --- diy1.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/diy1.py b/diy1.py index 5357560..0bdac29 100644 --- a/diy1.py +++ b/diy1.py @@ -1,12 +1,14 @@ import random -p=input("请出拳:石头/剪刀/布")# 玩家出拳 -print("玩家出拳:"+p) -w=["石头","剪刀","布"] -e=random.choice(w) -print("电脑出拳:"+e) -if p==e: - print("平局") -elif p=="石头" and e=="剪刀" or p=="布" and e=="石头" or p=="剪刀" and e=="布": - print("玩家赢") -else: - print("玩家输") \ No newline at end of file +玩家=input("请出拳:石头/剪刀/布")# 玩家出拳 +print("玩家出拳:"+玩家) +电脑=["石头","剪刀","布"] +电脑出拳=random.choice(电脑) +print("电脑出拳:"+电脑出拳) +if 玩家 in 电脑: + if 玩家==电脑出拳: + print("平局") + elif 玩家=="石头" and 电脑出拳=="剪刀" or 玩家=="布" and 电脑出拳=="石头" or 玩家=="剪刀" and 电脑出拳=="布": + print("玩家赢") + else: + print("玩家输") +else:print("输入错误") \ No newline at end of file -- libgit2 0.25.0