栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python计算连续复利

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python计算连续复利

python计算连续复利

Given principle amount, rate and time and we have to find the compound interest in Python.

给定原理量,速率和时间,我们必须找到Python的复利 。

计算复利 (Calculate compound interest)

To calculate compound interest, we use the following formula,

要计算复利,我们使用以下公式,

    P(1 + R / 100)T

Where,

哪里,

  • P – Principle amount

    P –本金

  • R – Rate of the interest, and

    R –利率,以及

  • T – Time in the years

    T –岁月

Example:

例:

    Input:
    p = 250000
    r = 36
    t = 1

    # formula
    ci =  p * (pow((1 + r / 100), t)) 
    print(ci)

    Output:
    339999.99999999994

Python程序找到复利 (Python program to find compound interest)
# Python program to find compound interest 

p = float(input("Enter the principle amount : "))
r = float(input("Enter the rate of interest : "))
t = float(input("Enter the time in the years: "))

# calculating compound interest
ci =  p * (pow((1 + r / 100), t)) 

# printing the values
print("Principle amount  : ", p)
print("Interest rate     : ", r)
print("Time in years     : ", t)
print("compound Interest : ", ci)

Output

输出量

First run:
Enter the principle amount : 10000
Enter the rate of interest : 3.5
Enter the time in the years: 1
Principle amount  :  10000.0
Interest rate     :  3.5
Time in years     :  1.0
compound Interest :  10350.0

Second run:
Enter the principle amount : 250000
Enter the rate of interest : 36
Enter the time in the years: 1
Principle amount  :  250000.0
Interest rate     :  36.0
Time in years     :  1.0
compound Interest :  339999.99999999994


翻译自: https://www.includehelp.com/python/program-for-compound-interest.aspx

python计算连续复利

转载请注明:文章转载自 www.mshxw.com
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号