Calculate Simple Interest in Python
SI = P*R*T / 100. Rate is percent, so 5 means 5%, not 0.05.
BeginnerBasic Python ProgramsExample 12 of 25
calculate-simple-interest.py
1# Program to calculate simple interest23principal = float(input("Enter principal amount: "))4rate = float(input("Enter annual interest rate (in %): "))5time = float(input("Enter time in years: "))67simple_interest = (principal * rate * time) / 10089print("Simple Interest is:", simple_interest)
Output
Enter principal amount: 1000 Enter annual interest rate (in %): 5 Enter time in years: 2 Simple Interest is: 100.0
In this one
- rate 5 means 5%, not 0.05
- 1000, 5%, 2 years → 100
What's going on
SI = P × R × T / 100. R is already a percent. Enter 5 for 5%, not 0.05, or you undercharge by 100×.
People mix this up with compound interest and start raising to powers. Not here. Three multiplies and a divide.
1000 at 5% for 2 years is 100. If you don't get 100, you treated 5 as 0.05.
After this program
If the idea is still fuzzy, read Day 1: Introduction to Python in the Python course. For a short check, try the Python quiz (300 questions). Stay with all 25 basic python programs, or see every topic on Python exercises.