小编Bee*_*tor的帖子

计算Python中的抵押贷款利息

我目前正在通过youtube上的视频教程学习python,并且遇到了一个我似乎无法掌握的公式,因为对我来说没什么好看的.除外的基本概念是制作抵押计算器,要求用户输入3条信息,贷款金额,利率和贷款期限(年)

然后它计算每月给用户的付款.这是我的代码:

__author__ = 'Rick'
# This program calculates monthly repayments on an interest rate loan/mortgage.

loanAmount = input("How much do you want to borrow? \n")
interestRate = input("What is the interest rate on your loan? \n")
repaymentLength = input("How many years to repay your loan? \n")

#converting the string input variables to float
loanAmount = float(loanAmount)
interestRate = float(interestRate)
repaymentLength = float(repaymentLength)

#working out the interest rate to a decimal number
interestCalculation = interestRate / 100

print(interestRate)
print(interestCalculation)

#working …
Run Code Online (Sandbox Code Playgroud)

python calculator formula python-3.x

9
推荐指数
3
解决办法
3万
查看次数

标签 统计

calculator ×1

formula ×1

python ×1

python-3.x ×1