使用所有給定值來計算簡單利息的 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