Hello, I have difficulty understanding part of the code of the following question:
You want to invest capital πΆ0 for n years at an annual interest rate of i%.
The relation is given by: πΆ = πΆ0*(1 + π)^π.
Write a program giving you the amount earned, the interest (πΌ = πΆ β πΆ0) of your
investment, as well as the equivalent monthly interest rate ππ under the database
provided. ππ = (1 + π)^(1/12) β 1.
The following would be the answer:
from math import *
C0 = float(input(βStarting capital: β))
i = float(input("Annual interest rate: "))
i = i / 100
u = 1 + i
n = int(input("Number of years: "))
print(ββ)
C = C0 * (un)
I = C - C0
im = u(1/12) - 1
C = int(100 * C)/100
I = int(100 * I)/100
im = int(10000 * im)/100
print(βCapital afterβ, n, βyears:β, C, ββ¬β)
print('Interest: ', I, ββ¬β)
print("Monthly interest rate: ", im, β%β)
The code I donβt understand is the following:
I do not understand why this was written, what it means and how it affects the code:
C = int(100 * C)/100
I = int(100 * I)/100
im = int(10000 * im)/100
Many thanks for who can help me out!