- 熱門類別
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHPPhysics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
關於複合利息的 Python 課程
在本文中,我們將瞭解如何解決並解決給定的問題陳述。
問題陳述 - 給定三個輸入值,即本金、利率和時間段,我們需要計算複合利息。
下面給出的程式碼展示了計算複合利息的過程。
這裡使用的公式是
Compound Interest = P(1 + R/100)r
其中,
P 為本金
R 為利率,
T 為時間段
實現如下
示例
def compound_interest(principle, rate, time):
CI = principle * (pow((1 + rate / 100), time))
print("Compound interest : ", CI)
# main
compound_interest(10000, 7.78, 2)輸出
Compound interest : 11616.528400000001
如下所示,所有變數和函式都在全域性範圍內宣告。

結論
在本文中,我們瞭解了計算複合利息的方法。
廣告