- 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 Program to Compute Simple Interest Given all the Required Values
When it is required to compute a simple interest when the amount, rate and interest are given, a simple formula can be defined, and the elements can be plugged into the formula.
Below is a demonstration of the same −
Example
principle_amt = float(input("Enter the principle amount...")) my_time = int(input("Enter the time in years...")) my_rate = float(input("Enter the rate...")) my_simple_interest=(principle_amt*my_time*my_rate)/100 print("The computed simple interest is :") print(my_simple_interest)
Output
Enter the principle amount...45000 Enter the time in years...3 Enter the rate...6 The computed simple interest is : 8100.0
Explanation
The principal amount, the rate of interest, and the time are taken as user inputs.
Another formula is defined to compute the simple interest.
This is assigned to a variable.
This is the computed value which is displayed on the console.
Advertisements