Before getting into the code of calculating **Simple Interest** in Python, lets understand how simple interest is calculated.

## What is Simple Interest?

Simple Interest is the amount of interest charge that you need to pay to the bank when you borrow money from them (a loan). There are three important variables that you would need to understand when writing your python program.

**Principal Amount (P)**: Principal is the amount that you have borrowed from the bank or the base price of the good or service that you have purchased and applied for a loan. Example if you brought a mortgage for $75,0000 USD than this amount is your principal.**Interest Rate (R)**: Interest rate is the price you need to pay to the bank for the Principal (Loan Amount) you borrowed. This is usually calculate annually. Interest is calculate in percentage. Example for a mortgage loan of $750,000 USD if the internet rate is 10% for a year (annual interest) then you need to pay $75,000 interest every year.**No of days (N)**: This is the tenor of the loan amount that you and the counter party have agreed upon.

## Formula for Simple Interest

**Simple Interest** = **(****P** [Principal Amount] **X** **N** [No of days] **X** **R** [Interest Rate]**)** **/** **100**

## Python code for Simple Interest calculation: SimpleInterest.py

```
# This is a Python program to calculate
# Simple Interest for the inputted
# Principal Amount, Rate of Interest,
# and Time frame
# Formula: (P x N x R)/100
#
# author: Code2care.org
def simple_interest_function(principal_amount,time_period_in_years,rate_of_interest):
print("Python Program to calculate Simple Interest")
print("-------------------------------------------")
print("Entered Principal Amount: ", principal_amount)
print("Entered Time Period in Years: ", time_period_in_years)
print("Entered Rate of Interest: ",rate_of_interest)
#Formula for Simple Interest
simple_interest = (principal_amount * time_period_in_years * rate_of_interest)/100
print('-------------------------------------------')
print("Simple Interest Calculated: ", simple_interest)
simple_interest_function(750000, 1, 10)
```

**Output:**

```
Python Program to calculate Simple Interest
-------------------------------------------
Entered Principal Amount: 750000
Entered Time Period in Years: 1
Entered Rate of Interest: 10
-------------------------------------------
Simple Interest Calculated: 75000.0
```

#### Comments:

- Thank you for the detailed example! It was useful for me!
01 Oct 2020 16:10:18 GMT
- Further comments disabled!

**More Posts related to Python,**

- How to convert int to ASCII in Python
- How to make use of SQLite Module in Python?
- Split a String into Sub-string and Parse in Python
- Python: Pandas Rename Columns with List Example
- How to run Python file from Mac Terminal
- How to Exit a Loop in Python Code
- Python: How to Plot a Histogram using Matplotlib and data as list
- MD5 Hashing in Python
- Jupyter: Safari Cant Connect to the Server localhost:8888/tree
- Fix: AttributeError: str object has no attribute decode. Did you mean: encode?[Python]
- How to Read a binary File with Python
- How to add two float numbers in Python
- Python: How to install YAML Package
- Python: How to Save Image from URL
- What is Markdown in Jupyter Notebook with Examples
- How to change the Python Default version
- 33: Python Program to send an email vid GMail
- How to comment code in Python
- How to Fix AttributeError in Python
- Fix: error: Jupyter command `jupyter-nbconvert` not found [VSCode]
- How to comment out a block of code in Python
- List of All 35 Reserved Keywords in Python Programming Language 3.11
- Import Other Python Files Examples
- Python: How to add Progress Bar in Console with Examples
- 3 Ways to convert bytes to String in Python

**More Posts:**

- [Fix] Microsoft teams error code 503 - Failed to reach https - Teams
- Running Android Lint has encountered a problem NullPointerException Error - Android
- Fix: zsh: command not found: adb (Android) - MacOS
- fix fatal: --local can only be used inside a git repository error - Git
- How to Get List of All Country Codes in Java Using Locale Class - Java
- PowerShell: How to Get Folder Size - Powershell
- How to install Apache Maven on Ubuntu - Ubuntu
- How to Execute cURL Command from Python Code - Python