toolkit20080127 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toolkit20080127-0.0.1/PKG-INFO +9 -0
- toolkit20080127-0.0.1/pyproject.toml +17 -0
- toolkit20080127-0.0.1/setup.cfg +4 -0
- toolkit20080127-0.0.1/toolkit/2026.11.23.3.py +95 -0
- toolkit20080127-0.0.1/toolkit/init.py +0 -0
- toolkit20080127-0.0.1/toolkit20080127.egg-info/PKG-INFO +9 -0
- toolkit20080127-0.0.1/toolkit20080127.egg-info/SOURCES.txt +7 -0
- toolkit20080127-0.0.1/toolkit20080127.egg-info/dependency_links.txt +1 -0
- toolkit20080127-0.0.1/toolkit20080127.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: toolkit20080127
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 一个简单的字符串处理工具包
|
|
5
|
+
Author-email: xxiao <bgn3721_2024@qq.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "toolkit20080127" # 名字最好带上学号防重名
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [{ name = "xxiao", email = "bgn3721_2024@qq.com" }]
|
|
9
|
+
description = "一个简单的字符串处理工具包"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
]
|
|
16
|
+
[tool.setuptools.packages.find]
|
|
17
|
+
include = ["toolkit*"]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import math
|
|
2
|
+
|
|
3
|
+
def calculate_bmi(weight, height):
|
|
4
|
+
"""计算BMI指数"""
|
|
5
|
+
if height <= 0:
|
|
6
|
+
return 0, "身高输入无效"
|
|
7
|
+
bmi = weight / (height ** 2)
|
|
8
|
+
if bmi < 18.5:
|
|
9
|
+
status = "偏瘦"
|
|
10
|
+
elif bmi < 24:
|
|
11
|
+
status = "正常"
|
|
12
|
+
elif bmi < 28:
|
|
13
|
+
status = "超重"
|
|
14
|
+
else:
|
|
15
|
+
status = "肥胖"
|
|
16
|
+
return round(bmi, 2), status
|
|
17
|
+
|
|
18
|
+
def calculate_calories(weight, duration, intensity):
|
|
19
|
+
"""
|
|
20
|
+
计算运动消耗的卡路里
|
|
21
|
+
参数: 体重(kg), 运动时长(min), 运动强度(低/中/高)
|
|
22
|
+
"""
|
|
23
|
+
if intensity == "低":
|
|
24
|
+
met = 3.0
|
|
25
|
+
elif intensity == "中":
|
|
26
|
+
met = 6.0
|
|
27
|
+
elif intensity == "高":
|
|
28
|
+
met = 9.0
|
|
29
|
+
else:
|
|
30
|
+
return -1
|
|
31
|
+
|
|
32
|
+
calories = met * weight * (duration / 60.0)
|
|
33
|
+
return round(calories, 2)
|
|
34
|
+
|
|
35
|
+
def evaluate_health(weight, bmi, calories_burned, target_calories):
|
|
36
|
+
"""
|
|
37
|
+
综合健康评估函数(接收 4 个参数)
|
|
38
|
+
返回评估报告字符串
|
|
39
|
+
"""
|
|
40
|
+
report = f"--- 健康评估报告 ---\\n"
|
|
41
|
+
report += f"当前体重: {weight} kg\\n"
|
|
42
|
+
report += f"BMI指数: {bmi}\\n"
|
|
43
|
+
report += f"本次运动消耗: {calories_burned} kcal\\n"
|
|
44
|
+
|
|
45
|
+
if calories_burned >= target_calories:
|
|
46
|
+
report += "运动目标: 已达成!非常棒!\\n"
|
|
47
|
+
else:
|
|
48
|
+
report += f"运动目标: 未达成,距离目标还差 {round(target_calories - calories_burned, 2)} kcal\\n"
|
|
49
|
+
|
|
50
|
+
if bmi > 24:
|
|
51
|
+
report += "建议: 体重偏重,建议增加有氧运动并控制饮食。\\n"
|
|
52
|
+
elif bmi < 18.5:
|
|
53
|
+
report += "建议: 体重偏轻,建议增加力量训练并补充营养。\\n"
|
|
54
|
+
else:
|
|
55
|
+
report += "建议: 身体状况良好,请继续保持!\\n"
|
|
56
|
+
|
|
57
|
+
return report
|
|
58
|
+
|
|
59
|
+
def main():
|
|
60
|
+
print("="*30)
|
|
61
|
+
print(" 欢迎使用个人健康与运动消耗计算器")
|
|
62
|
+
print("="*30)
|
|
63
|
+
|
|
64
|
+
try:
|
|
65
|
+
weight = float(input("请输入您的体重(kg),例如 65.5: "))
|
|
66
|
+
height = float(input("请输入您的身高(m),例如 1.75: "))
|
|
67
|
+
duration = float(input("请输入本次运动时长(分钟),例如 45: "))
|
|
68
|
+
intensity = input("请输入运动强度(低/中/高): ")
|
|
69
|
+
target_calories = float(input("请输入您的目标消耗卡路里(kcal): "))
|
|
70
|
+
except ValueError:
|
|
71
|
+
print("输入格式错误,请输入数字!")
|
|
72
|
+
return
|
|
73
|
+
|
|
74
|
+
print("\\n正在为您计算,请稍候...\\n")
|
|
75
|
+
bmi_value, bmi_status = calculate_bmi(weight, height)
|
|
76
|
+
calories = calculate_calories(weight, duration, intensity)
|
|
77
|
+
|
|
78
|
+
if calories == -1:
|
|
79
|
+
print("运动强度输入错误,请重新运行程序并输入 低/中/高")
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
print(f"您的BMI指数为: {bmi_value} ({bmi_status})")
|
|
83
|
+
print(f"本次运动估算消耗: {calories} 千卡")
|
|
84
|
+
|
|
85
|
+
report = evaluate_health(weight, bmi_value, calories, target_calories)
|
|
86
|
+
print("\\n" + report)
|
|
87
|
+
print("="*30)
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
while True:
|
|
91
|
+
main()
|
|
92
|
+
cont = input("是否继续使用?(y/n): ")
|
|
93
|
+
if cont.lower() != 'y':
|
|
94
|
+
print("感谢使用,再见!")
|
|
95
|
+
break
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: toolkit20080127
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 一个简单的字符串处理工具包
|
|
5
|
+
Author-email: xxiao <bgn3721_2024@qq.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
toolkit
|