基本贷款计算器
Basic Loan calculator
我知道我有点傻,但我一直在努力让这段简单的代码(计算项目的一部分)四舍五入到小数点后第二位,但到目前为止我还没有能够做到。
loan = float(input("Please enter Amount that you would like to borrow (£):"))
loanduration = float(input("Please enter Duration of the loan(Months):"))
print("You will pay (£)" ,loan/loanduration, "per month")
It outputs like so
Please enter Amount that you would like to borrow (£):4000
Please enter Duration of the loan(Months):12
You will pay (£) 333.3333333333333 per month
>>>
loan = float(input("Please enter Amount that you would like to borrow (£): "))
loanduration = float(input("Please enter Duration of the loan(Months): "))
print("You will pay (£) %.2f per month" % (loan/loanduration))
用法示例:
Please enter Amount that you would like to borrow (£): 4000
Please enter Duration of the loan(Months): 12
You will pay (£) 333.33 per month
试一试here!
我知道我有点傻,但我一直在努力让这段简单的代码(计算项目的一部分)四舍五入到小数点后第二位,但到目前为止我还没有能够做到。
loan = float(input("Please enter Amount that you would like to borrow (£):"))
loanduration = float(input("Please enter Duration of the loan(Months):"))
print("You will pay (£)" ,loan/loanduration, "per month")
It outputs like so
Please enter Amount that you would like to borrow (£):4000
Please enter Duration of the loan(Months):12
You will pay (£) 333.3333333333333 per month
>>>
loan = float(input("Please enter Amount that you would like to borrow (£): "))
loanduration = float(input("Please enter Duration of the loan(Months): "))
print("You will pay (£) %.2f per month" % (loan/loanduration))
用法示例:
Please enter Amount that you would like to borrow (£): 4000
Please enter Duration of the loan(Months): 12
You will pay (£) 333.33 per month
试一试here!