Python Program for simple interest
pythonserver side programmingprogramming更新于 2025/11/20 1:48:17
In this article, we will learn about the calculation of simple interest in Python 3.x. Or earlier.
Simple interest is calculated by multiplying the daily interest rate by the principal amount by the number of days that elapse between the payments.
Mathematically,
Simple Interest = (P x T x R)/100 Where, P is the principal amount T is the time and R is the rate
例如
If P = 1000,R = 1,T = 2 Then SI=20.0 Now let’s see how we can implement a simple interest calculator in Python.
示例
P = 1000
R = 1
T = 2
# 简单利息
SI = (P * R * T) / 100
print("简单利息是", SI)
输出
简单利息是 20.0
这里简单利息是通过三次乘积和一次除法得到的。
现在让我们看看声明的变量的范围。如下图所示,所有变量均在全局范围中声明。

结论
在本文中,我们了解了单利及其使用 Python 脚本的实现。
相关文章
有用资源
python 参考教程 - 该教程包含有关 python 的更多信息:https://www.cainiaomax.com/python/

