**** 贷款公式
def calculate_monthly_payment(loan_amount, loan_years, annual_rate):
"""
计算等额本息还款每月还款额
:param loan_amount: 贷款总额,单位:万元
:param loan_years: 还款年限,单位:年
:param annual_rate: 年利率,单位:百分比,例如,5.88 表示 5.88%
:return: 每月还款额,单位:元
"""
# 将年利率转换为月利率
monthly_rate = annual_rate / 12 / 100
# 将还款年限转换为还款月数
num_of_payments = loan_years * 12
# 计算每月还款额
monthly_payment = loan_amount * monthly_rate * (1 + monthly_rate) ** num_of_payments / ((1 + monthly_rate) ** num_of_payments - 1)
return monthly_payment * 10000
calculate_monthly_payment(100, 20, 5.88) # 7095.254556255669