From 5edaa6627a8dec10fb02c6fbbd928fcc72c71c0e Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 12 Mar 2023 11:06:17 +0800 Subject: [PATCH] save project --- jk.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/jk.py b/jk.py index 035a211..b7cf697 100644 --- a/jk.py +++ b/jk.py @@ -4,18 +4,16 @@ import random list=["石头","剪刀", "布"] computer=random.choice(list) print("电脑出拳:"+computer) - - - - - -if player==computer: - print("平局") -elif player=="石头"and computer=="剪刀": - print("恭喜,你赢了") -elif player=="剪刀"and computer=="布": - print("恭喜,你赢了) -elif player=="布"and computer=="石头": - print("恭喜你,你赢了") -else: - print("很遗憾,你输了") \ No newline at end of file +if player in list: + if player==computer: + print("平局") + elif player=="石头"and computer=="剪刀": + print("恭喜,你赢了") + elif player=="剪刀"and computer=="布": + print("恭喜,你赢了") + elif player=="布"and computer=="石头": + print("恭喜你,你赢了") + else: + print("很遗憾,你输了") +else: + print("输入错误") \ No newline at end of file -- libgit2 0.25.0