点击查看代码
```3.1
def calculate_earth_weight(current_weight):return current_weight + 0.5def calculate_moon_weight(earth_weight):return earth_weight * 0.165earth_weight = float(input("请输入你在地球上的初始体重(kg):"))for year in range(1, 11):earth_weight = calculate_earth_weight(earth_weight)moon_weight = calculate_moon_weight(earth_weight)print(f"第{year}年,地球上体重是{earth_weight:.1f}kg,月球上体重是{moon_weight:.1f}kg")
</details><details>
<summary>点击查看代码</summary>
3.2
ability = 1
days = 0
while days < 365:
for i in range(7):
if i >= 3:
ability = ability * (1 + 0.01)
days += 1
if days >= 365:
break
print(ability)
print(ability)
</details>
<details>
<summary>点击查看代码</summary>
3.3
period_10 = 365 // 11
remain_10 = 365 % 11
r = 0.01
ability_10 = (1 + r) ** (10 * period_10)
ability_10 = ability_10 * (1 + r) ** remain_10
print(f"每10天休息1天,365天后能力值约是{ability_10:.2f}")
period_15 = 365 // 16
remain_15 = 365 % 16
ability_15 = (1 + r) ** (15 * period_15)
ability_15 = ability_15 * (1 + r) ** remain_15
print(f"每15天休息1天,365天后能力值约是{ability_15:.2f}")
</details>
<details>
<summary>点击查看代码</summary>
3.4
n = int(input("请输入一个5位数字:"))
a = n % 10
b = (n // 10) % 10
c = (n // 100) % 10
d = (n // 1000) % 10
e = n // 10000
reversed_num = a * 10000 + b * 1000 + c * 100 + d * 10 + e
if reversed_num == n:
print("这个数字是回文数")
else:
print("这个数字不是回文数")
</details>
<details>
<summary>点击查看代码</summary>
3.5
print('+ ---- + ---- +')
for i in range(4):
print('| | |')
print('+ ---- + ---- +')
for i in range(4):
print('| | |')
print('+ ---- + ---- +')
</details>