From 9cf0b1bd871a8086cb81a464732cc40a8a6dbb24 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Wed, 31 Jul 2024 09:38:50 +0800 Subject: [PATCH] auto save --- 1.py | 21 ++++++++++++--------- 2.py | 5 +++++ jk.py | 32 ++++++++++++++++++-------------- 3 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 2.py diff --git a/1.py b/1.py index 58b1ee6..a830aab 100644 --- a/1.py +++ b/1.py @@ -6,13 +6,16 @@ list=["剪刀","石头","布"] w=random.choice(list) print("电脑出拳:"+w) -if q==w: - print("平局") -elif q=="剪刀" and w=="布": - print("你赢了") -elif q=="石头" and w=="剪刀": - print("你赢了") -elif q=="布" and w=="石头": - print("你赢了") +if q in list: + if q==w: + print("平局") + elif q=="剪刀" and w=="布": + print("你赢了") + elif q=="石头" and w=="剪刀": + print("你赢了") + elif q=="布" and w=="石头": + print("你赢了") + else: + print("你输了") else: - print("你输了") \ No newline at end of file + print("输入错误") \ No newline at end of file diff --git a/2.py b/2.py new file mode 100644 index 0000000..1b0d26b --- /dev/null +++ b/2.py @@ -0,0 +1,5 @@ +import turtle +pen=turtle.Pen() +pen.write("致诺伊:\n你最近好吗,\n我新学了一首诗念给你听.\n《静夜思》",font=("方正舒体",40,"normal")) +pen.hideturtle() +turtle.done() diff --git a/jk.py b/jk.py index b778d0a..2dd7ccc 100644 --- a/jk.py +++ b/jk.py @@ -1,18 +1,22 @@ -player=input("请出拳") -print("玩家出拳:"+player) +q=input("请出拳") +print("玩家出拳:"+q) import random list=["剪刀","石头","布"] -computer=random.choice(list) -print("电脑出拳:"+computer) +w=random.choice(list) +print("电脑出拳:"+w) + +if q in list: + if q==w: + print("平局") + elif q=="剪刀" and w=="布": + print("你赢了") + elif q=="石头" and w=="剪刀": + print("你赢了") + elif q=="布" and w=="石头": + print("你赢了") + else: + print("你输了") +else: + print("输入错误") -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 -- libgit2 0.25.0