How to calculate simple interest in python

BATHULA PRAVEEN (BP)
0

 How to calculate simple interest for days ,months and years?

->calculate simple interest by using this formula

si=(p*t*r)/100

->This statement is per day interest

day=si/360 

->This statement is per month interest

month=day*30


Python code


p=float(input("Enter Money:")) #Principle amount

t=12 #total months

r=float(input("Enter rate:")) # rate of interest

#calculate simple interest by using this formula

si=(p*t*r)/100

print("Simple interest is",si)

day=si/360  #This statement is per day interest

month=day*30  #This statement is per month interest

choice=int(input("Choose one choice :"))

#choice(1) calculate years  interest

#choice(2) calculate months  interest

#choice(3) calculate days  interest

if choice==1:

    #calculate years  interest

    y=int(input("Enter How many years You have to choose :"))

    print("Only interest for years:",si*y)

    year=p+(si*y)

    print("Total ammount with interest :",year)

elif choice==2:

    #calculate months  interest

    m=int(input("Enter How many Months You have to choose :"))

    print("Only interest for months:",month*m)

    months=p+(month*m)

    print("Total ammount with interest:",months)

elif choice==3:

    #calculate days interest

    d=int(input("Enter How Many Days you have to choose :"))

    print("only interest for days:",day*d)

    days=p+(day*d)

    print("Total ammount with interest:",days)

else:

    print("Please take valid choice")

    


                                                         BATHULA PRAVEEN


Post a Comment

0Comments

Post a Comment (0)