Python程序计算单利

编写一个Python程序来计算单利,并附有示例。在开始示例之前,我将向您展示单利计算背后的公式。

SI = (本金 * 利率 * 年数) / 100

这个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))
Calculate Simple Interest Example