From 56640d70b85b81ca1586df1292357b7d04928290 Mon Sep 17 00:00:00 2001 From: Serena Date: Mon, 7 Jul 2025 22:09:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AA=E6=B8=B8=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 +++++++ .idea/game.iml | 10 ++++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++++ .idea/misc.xml | 6 +++++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 6 +++++ game1.py | 23 +++++++++++++++++++ 7 files changed, 67 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/game.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 game1.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/game.iml b/.idea/game.iml new file mode 100644 index 0000000..1eec003 --- /dev/null +++ b/.idea/game.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c2f99c1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ffbc64a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/game1.py b/game1.py new file mode 100644 index 0000000..416f695 --- /dev/null +++ b/game1.py @@ -0,0 +1,23 @@ +import random + +def game1(): + numbers = random.randint(1, 100) + print("我已经想好了1-100的任意一个数,你能猜到是哪个吗?") + + while True: + try: + user_number = int(input("请输入你的猜测数字:")) + if user_number>100 or user_number<1: + print("请输入一个1-100的数字") + elif user_number>numbers: + print("你的数字太大了") + elif user_number