From 6bb07bf72de927313c8e0ca3906ca72eca68c4fc Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Tue, 11 Aug 2020 20:05:47 +0800 Subject: [PATCH] save project --- diy1.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/diy1.py b/diy1.py index 60094c7..cdca81b 100644 --- a/diy1.py +++ b/diy1.py @@ -5,14 +5,16 @@ import random list=["石头","剪刀","布"] computer=random.choice(list) print(computer) - if play==computer: - print("平局") - play=="石头" and computer=="剪刀": - print("play赢") -elif play=="布" and computer=="石头": - print("play赢") -elif play=="剪刀" and computer=="布": - print("play赢") +if play in list: + if play==computer: + print("平局") + elif play=="石头" and computer=="剪刀": + print("play赢") + elif play=="布" and computer=="石头": + print("play赢") + elif play=="剪刀" and computer=="布": + print("play赢") + else: + print("play输") else: - print("play输") - + print("输入错误") \ No newline at end of file -- libgit2 0.25.0