From 8dd802986a4223c648318a8fb0ee3b6a009e73d4 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Thu, 12 Aug 2021 15:22:03 +0800 Subject: [PATCH] save project --- diy1.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/diy1.py b/diy1.py index dbac007..f580c63 100644 --- a/diy1.py +++ b/diy1.py @@ -2,11 +2,14 @@ import random list = ["石头","剪刀","布"] player = input("你要出什么:") print("玩家出"+player) -robot = random.choice(list) -print("电脑出"+robot) -if player==robot: - print("平局") -elif (player == "石头" and robot == "剪刀")or(player == "剪刀" and robot == "布")or(player == "布" and robot == "石头"): - print("玩家胜利") +if player in list: + robot = random.choice(list) + print("电脑出"+robot) + if player==robot: + print("平局") + elif (player == "石头" and robot == "剪刀")or(player == "剪刀" and robot == "布")or(player == "布" and robot == "石头"): + print("玩家胜利") + else: + print("电脑胜利") else: - print("电脑胜利") \ No newline at end of file + print("你个肮脏的作弊者") \ No newline at end of file -- libgit2 0.25.0