9.14python
九九乘法表
for i in range(1, 10):
for j in range(1, i + 1):
print(f"{j}*{i}=%-3d" % (i * j), end="")
if j == i:
print("\n", end="")
逢7拍手
for i in range(1, 100):
f = 0
if i % 7 == 0: # 倍数
f = 1
#print("a")
elif i // 10 == 7: # 十位
f = 1
#print("c")
elif i % 10 == 7: # 个位
f = 1
#print("b")
if f == 1:
print(i)
房贷计算器
# 月供 mopay 贷款金额 money 月利率 x 期限 ddl 还款总额 paysum 支付利息 pay
# int贷款金额money 期限ddl 种类type
# 月供
money = int(input("请输入贷款金额:(万元)"))
ddl = int(input("请输入还款期限:(年)"))
type_ = int(input("请输入贷款种类:(商业:1/公积金:2)"))
if type_ == 1:
if ddl <= 5:
x = 0.0475/12
else:
x = 0.049/12
elif type_ == 2:
if ddl <= 5:
x = 0.0275/12
else:
x = 0.0325/12
else:
print("种类错误")
mopay = money * (x * (1 + x) ** (ddl * 12)) / (((1 + x) ** (ddl * 12)) - 1)
paysum = mopay * ddl * 12
pay = paysum - money
print(f"每月月供参考:{mopay},还款总额:{paysum},支付利息:{pay}")