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.
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
Related Questions
Write a program to read a number n and print n2, n3 and n4.
Write a program to compute simple interest and compound interest.
Write a program to read details like name, class, age of a student and then print the details firstly in same line and then in separate lines. Make sure to have two blank lines in these two different types of prints.
(a) What will be the output produced by following code fragments ?
(i)
a, b = 2, 3 c, b = a, c + 1 print a, b, c(ii)
x, y = 2, 6 x, y = y, x + 2 print x, y(b) What will the output produced if we interchange the first two lines of above two codes [given in part (a)], e.g., as shown below for code (i) ? Will it give any error ? Give reason(s).
c, b = a, c + 1 a, b = 2, 3 print a, b, c