
- 热门类别
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
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
如下所示,所有变量和函数都在全局范围内声明。
Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.
结论
在本文中,我们了解了计算复合利息的方法。
广告