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

說明

  • 本金金額、利率及時間均以使用者輸入形式獲取。

  • 定義另一個公式來計算簡單利息。

  • 將其分配給一個變數。

  • 這是將顯示在控制檯的計算數值。

更新於: 16-4-2021

257 次瀏覽

開啟您的職業生涯

完成課程,獲得認證

開始入門
廣告
© . All rights reserved.