From 19ad8fa956ca2144fee512fbaf4270e2c4037739 Mon Sep 17 00:00:00 2001
From: YXYaaaa <16270691+yxyaaaa@user.noreply.gitee.com>
Date: Sat, 8 Aug 2026 13:17:35 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 10 +++
.../inspectionProfiles/profiles_settings.xml | 6 ++
.idea/modules.xml | 8 +++
.idea/python.iml | 12 ++++
.idea/vcs.xml | 6 ++
GuessGame.py | 72 +++++++++++++++++++
IfWhile.py | 68 ++++++++++++++++++
zidian.py | 27 +++++++
8 files changed, 209 insertions(+)
create mode 100644 .idea/.gitignore
create mode 100644 .idea/inspectionProfiles/profiles_settings.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/python.iml
create mode 100644 .idea/vcs.xml
create mode 100644 GuessGame.py
create mode 100644 IfWhile.py
create mode 100644 zidian.py
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..30cf57e
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Ignored default folder with query files
+/queries/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
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/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..614b3c1
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/python.iml b/.idea/python.iml
new file mode 100644
index 0000000..5194d14
--- /dev/null
+++ b/.idea/python.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GuessGame.py b/GuessGame.py
new file mode 100644
index 0000000..5d937a3
--- /dev/null
+++ b/GuessGame.py
@@ -0,0 +1,72 @@
+#v1.0
+# from random import randint
+#
+# def main():
+# a=randint(1,100)
+# print(a)
+# b=False
+# while not b:
+# n = int(input())
+# if a==n:
+# print("你猜对了")
+# b=True
+# elif a>n:
+# print("小了")
+# else:
+# print("大了")
+#
+# main()
+
+# #v2.0
+# from random import randint
+#
+# def main():
+# a=randint(1,100)
+# print(a)
+# b=5000
+# while b>0:
+# n = int(input())
+# if a==n:
+# print("你猜对了")
+# b+=3000
+# print(f'剩余金币:{b}')
+# elif a>n:
+# print("小了")
+# b-=500
+# print(f'剩余金币:{b}')
+# else:
+# print("大了")
+# b-=500
+# print(f'剩余金币:{b}')
+# main()
+
+#v3.0
+from random import randint
+
+def main():
+ a=randint(1,100)
+ print(a)
+ b=False
+ while not b:
+ n = int(input())
+ if a==n:
+ print("你猜对了,是否继续?Y/N")
+ while True:
+ c=input()
+ if c=="Y":
+ a = randint(1, 100)
+ print(a)
+ b=False
+ break
+ elif c=="N":
+ b=True
+ break
+ else:
+ print("请输入Y/N")
+
+ elif a>n:
+ print("小了")
+ else:
+ print("大了")
+
+main()
\ No newline at end of file
diff --git a/IfWhile.py b/IfWhile.py
new file mode 100644
index 0000000..c5163b8
--- /dev/null
+++ b/IfWhile.py
@@ -0,0 +1,68 @@
+#1简单说下python与java语言的区别?
+# Python 是动态类型语言,变量不需要声明类型,Python 是解释执行的,运行速度相对慢一些
+# Java 是静态类型语言,变量、参数、返回值都要明确声明类型,编译时就能发现很多类型错误
+
+#2Python支持哪些数据类型?
+# 整型 浮点 数组 字符串 列表 布尔 元祖 集合
+
+#3使用print() 打印6 + 9的和
+# print(6+9)
+# print(sum([6,9]))
+
+#4定义两个变量stu1和stu2,分别存储45和23,并用print()打印两个数的和
+# stu1=45
+# stu2=23
+# print(stu1+stu2)
+# print(sum([stu1,stu2]))
+
+#5定义三个变量:num1,num2,num3,并用print()打印3个数的和
+# num1=1
+# num2=2
+# num3=3
+# print(num1+num2+num3)
+# print(sum([num1,num2,num3]))
+
+#6定义一个变量num1,并赋值45.然后将num1值赋值给num2。打印出来
+# num1=45
+# num2=num1
+# print(num2)
+
+#7从键盘输入一个人的信息:姓名,年龄,身高,体重,地址,并打印出来
+# a=input().split()
+# for i in range(0,len(a)):
+# print(a[i])
+
+#8打印出1~100的所有数字,然后只打印出是3的倍数的数字即可,请编程
+# for i in range(1,101):
+# if i%3==0:
+# print(i)
+
+#9现在需要从键盘循环录入10个人的英语并打印出来
+# a=[]
+# for i in range(0,10):
+# a.append(int(input()))
+# print(a)
+
+#10针对上面程序进行优化,对10个人的分数进行求和
+# a=[]
+# for i in range(0,10):
+# a.append(int(input()))
+# print(sum(a))
+
+#11使用循环打印九层星号”*”
+# for i in range(9):
+# print("*"*i)
+
+#12
+# a=[]
+# for i in range(1,10):
+# a.append(i)
+# print(a)
+
+#13 九九乘法表
+for i in range(1,10):
+ for j in range(1,i+1):
+ print(f"{j} x {i} = {i*j}",end=" ")
+ print()
+
+
diff --git a/zidian.py b/zidian.py
new file mode 100644
index 0000000..ffdc232
--- /dev/null
+++ b/zidian.py
@@ -0,0 +1,27 @@
+score = {
+ "张三": {"数学": 98, "语文": 87, "物理": 79},
+ "李四": {"化学": 86, "语文": 97, "数学": 69},
+ "王五": {"化学": 89, "语文": 69, "数学": 89}
+}
+key=list(score.keys())
+#语文成绩最高
+maxx=key[0]
+for i in score:
+ if score[i]["语文"]>score[maxx]["语文"]:
+ maxx=i
+print(maxx,score[maxx]["语文"])
+#每个人总分
+for i in score:
+ total=sum(score[i].values())
+ print(i,total)
+#排名
+totals=[]
+for i in score:
+ total=sum(score[i].values())
+ totals.append(total)
+for i in range(len(key)):
+ for j in range(len(key)-i):
+ if totals[j]>totals[j+i]:
+ key[j],key[j+1]=key[j+i],key[j]
+for i in range(1,len(key)+1):
+ print(f"第{i}名:{key[i-1]} {totals[i-1]}分")
--
Gitee