Computer Applications

A bank account contains ₹10,000 and earns interest at the rate of 5 percent per year. The interest is added to the account. After one year the bank account contains the original sum of ₹10,000 plus the interest, which is 5% of ₹10,000, i.e., 10,000 * (5/100).

So, the final account balance is 10000 + 10000 * (5/100) = 10000 * (1 + (5/100)) = 10000 * 1.05.

(a) Write Python code script to calculate the balance in account as per this after one year.

(b) Write Python code script to calculate the balance in account as per this after four years while showing balance after every year.

(c) Write Python script that displays the number of takes for the account balance to be at least double the original balance.

Python Funda

15 Likes

Answer

(a) Python code script to calculate the balance in account after one year:

p = 10000
r = 5
si = p * r  / 100
bal = p + si
print ("Balance = ₹", bal)
Output
Balance = ₹ 10500.0

(b) Python code script to calculate the balance in account after four year while showing balance after every year:

p = 10000
r = 5
si = p * r / 100
p = p + si
print ("Balance after 1st year = ₹", p) 
si = p * r / 100
p = p + si
print ("Balance after 2nd year = ₹", p) 
si = p * r / 100
p = p + si
print ("Balance after 3rd year = ₹", p) 
si = p * r / 100
p = p + si
print ("Balance after 4th year = ₹", p) 
Output
Balance after 1st year = ₹ 10500.0
Balance after 2nd year = ₹ 11025.0
Balance after 3rd year = ₹ 11576.25
Balance after 4th year = ₹ 12155.0625

(c) Python code script to display the number of takes for the account balance to be at least double the original balance:

p = 10000
r = 5
t = p * 2
c = 0
while p < t:
    si = p * r  / 100
    p = p + si
    c = c + 1
print ("No. of takes =", c)
Output
No. of takes = 15

Answered By

9 Likes


Related Questions