Simple Interest Calculator
Calculate simple interest and amount with floats. Students convert an annual percent rate, keep interest separate from principal, and format monetary examples.
1# Take inputs2principal = float(input("Enter principal: "))3rate = float(input("Enter rate (%): "))4time = float(input("Enter time (years): "))56# Calculate7interest = (principal * rate * time) / 1008amount = principal + interest910print(f"Simple Interest: {interest:.2f}")11print(f"Total Amount: {amount:.2f}")
Output
Enter principal: 10000 Enter rate (%): 5 Enter time (years): 2 Simple Interest: 1000.00 Total Amount: 11000.00
In this one
- Convert percentage rates
- Separate interest and balance
- Understand no-compounding assumptions
How it works
- 1
Read principal, rate, and years.
- 2
Calculate principal * rate * time / 100.
- 3
Add principal and display interest and amount.
Edge cases
What if time is zero?
What if time is zero?
Interest is zero and amount equals principal.
Are negative inputs rejected?
Are negative inputs rejected?
No. The code applies the formula without financial input validation.
What's going on
interest is principal * rate * time / 100. The division converts a percentage such as five into its fractional rate.
amount adds the interest back to the original principal. With principal 1000, rate five, and time two years, interest is 100 and amount 1100. This does not compound: interest is not added to the base during the period. Float formatting is illustrative, not accounting-grade decimal arithmetic.
What if time is zero? Interest is zero and amount equals principal.
Are negative inputs rejected? No. The code applies the formula without financial input validation.
Quiz
Tap an option. The answer stays hidden until you pick.
Question 1
What distinguishes simple interest here?
Pick an answer to check it.
Question 2
What if time is zero?
Pick an answer to check it.
Questions people ask
What if time is zero?
Interest is zero and amount equals principal.
Are negative inputs rejected?
No. The code applies the formula without financial input validation.
What distinguishes simple interest here?
Interest uses the original principal.
๐Related Content
- ๐
Phase 6 - Learn Concepts
Review Phase 6 concepts and explanations
- ๐
Phase 6 - Quiz
Test your Phase 6 understanding with quiz questions
- ๐ป
Phase 6 - All Practice Problems
Explore all practice problems for Phase 6
- ๐
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- ๐ง
Logic Building Overview
Learn about the complete logic building curriculum