🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
1. Introduction
Simple Interest is a method to calculate the interest charge on a loan or the earned interest on a deposit. It is one of the most basic financial concepts used in banking, finance, and everyday life scenarios like saving schemes or taking loans. In this article, we will write a Python program to calculate simple interest based on the provided principal amount, rate of interest, and time period.
2. Program Overview
The program will:
1. Ask the user to input the Principal amount (P), Rate of interest (R), and Time period (T).
2. Calculate the simple interest using the formula:
Simple Interest (SI) = P × T × R ⁄ 100
3. Display the calculated simple interest.
3. Code Program
# User input for Principal, Rate of Interest, and Time
principal = float(input("Enter the Principal amount: "))
rate_of_interest = float(input("Enter the Rate of Interest (in %): "))
time_period = float(input("Enter the Time period (in years): "))
# Calculation of Simple Interest
simple_interest = (principal * rate_of_interest * time_period) / 100
# Displaying the Simple Interest
print(f"The Simple Interest for a principal amount of {principal}, at a rate of {rate_of_interest}% for {time_period} years is: {simple_interest}")
Output:
Enter the Principal amount: 1000 Enter the Rate of Interest (in %): 5 Enter the Time period (in years): 2 The Simple Interest for a principal amount of 1000.0, at a rate of 5.0% for 2.0 years is: 100.0
4. Step By Step Explanation
1. The program starts by gathering the necessary data: Principal amount, Rate of Interest, and Time period from the user. The input function fetches this information in string format. To facilitate calculations, these string values are transformed into floating-point numbers via the float function.
2. The formula for simple interest is then applied to compute the interest.
3. Finally, the print function displays the user-provided data and the computed simple interest.
This Python program illustrates the power of the language to easily handle and solve everyday mathematical and financial problems.
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
ChatGPT + Generative AI + Prompt Engineering for Beginners
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
Testing Spring Boot Application with JUnit and Mockito
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
Available in Udemy for Business
Master Spring Data JPA with Hibernate
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
Available in Udemy for Business
Comments
Post a Comment
Leave Comment