Python 程序:计算单利
后浪云Python教程:
用例子写一个计算简单利息的 Python 程序。在我们进入示例之前,让我向您展示简单利息计算背后的公式:
单利=(本金利率年数)/ 100
计算单利的 Python 程序
这个 Python 程序允许用户输入本金金额、投资回报率和年数。通过使用这些值,程序使用上述公式计算简单利息。
princ_amount = float(input(" Please Enter the Principal Amount : "))
rate_of_int = float(input(" Please Enter the Rate Of Interest : "))
time_period = float(input(" Please Enter Time period in Years : "))
simple_interest = (princ_amount * rate_of_int * time_period) / 100
print("\nSimple Interest for Principal Amount {0} = {1}".format(princ_amount, simple_interest))
版权声明:
作者:后浪云
链接:https://www.idc.net/help/184093/
文章版权归作者所有,未经允许请勿转载。
THE END