docs: 2026-03-17作业+PPT
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
# 判断整数是否是回文数
|
||||||
|
|
||||||
|
n = int(input("请输入整数: "))
|
||||||
|
sn = str(n)
|
||||||
|
if sn == sn[::-1]:
|
||||||
|
print("输入的是回文数")
|
||||||
|
else:
|
||||||
|
print("输入的不是回文数")
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# 物流计费系统
|
||||||
|
|
||||||
|
d = {"01": (13, 3), "02": (12, 2), "03": [14, 4]}
|
||||||
|
area = input("请输入地区编号: ")
|
||||||
|
weight = 0
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
weight = int(input("请输入重量(kg): "))
|
||||||
|
break
|
||||||
|
except ValueError:
|
||||||
|
print("请输入整数...")
|
||||||
|
if area not in d:
|
||||||
|
print("地区编号不正确,请输入正确的地区编号")
|
||||||
|
else:
|
||||||
|
(p1, p2) = d[area]
|
||||||
|
if weight < 2:
|
||||||
|
weight = 2
|
||||||
|
print("价格是: " + str(p1 + (weight - 2) * p2))
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# 九九乘法表
|
||||||
|
|
||||||
|
n = 9
|
||||||
|
for i in range(1, n + 1):
|
||||||
|
for j in range(1, i + 1):
|
||||||
|
print(j, '*', i, '=', i * j, sep=" ", end="\t")
|
||||||
|
print()
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user