使用所有给定值来计算简单利息的 Python 程序
当需要计算出给定期限、利率和金额时,可以定义一个简单的公式,并将元素插入到公式中。
以下是同一操作的演示 −
示例
principle_amt = float(input("Enter the principle amount..."))
my_time = int(input("Enter the time in years..."))
my_rate = float(input("Enter the rate..."))
my_simple_interest=(principle_amt*my_time*my_rate)/100
print("The computed simple interest is :")
print(my_simple_interest)输出
Enter the principle amount...45000 Enter the time in years...3 Enter the rate...6 The computed simple interest is : 8100.0
说明
本金金额、利率及时间均以用户输入形式获取。
定义另一个公式来计算简单利息。
将其分配给一个变量。
这是将显示在控制台的计算数值。
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP