6.1: Simple Interest
October 23, 2019 · View on GitHub
The Problem
You borrowed $5000 for 2 years with 2% interest per year. Calculate the simple interest to know how much you have to pay?
Hint
Just take amount, duration and interest rate.
You have to multiply these three. And, don’t forget: you have to convert percent to a fraction by dividing it by 100.
The Solution
principle = int(input("Money you borrowed: "))
interest_rate = float(input("Interest Rate: "))
time = float(input("Overall Duration: "))
# Calculates simple interest
simple_interest = principle * (interest_rate/100) * time
print("Simple interest is:", simple_interest)
Explanation
Read the code. I think you don’t need any extra explanation here.
tags: programming-hero python python3 problem-solving programming coding-challenge interview learn-python python-tutorial programming-exercises programming-challenges programming-fundamentals programming-contest python-coding-challenges python-problem-solving
