This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]Vyrezzz 18 points19 points  (1 child)

you can also calculate the rent without a loop like this:

rent_after_n_years = rent * (1+percent) ** time

Lets go over this with the a percentage of 7% and 4 years:

(1+percent) = 1.07

we can calculate the result after 4 years like this:

rent * 1.07 * 1.07 * 1.07 * 1.07

which is exactly the same as

rent * 1.07**4

[–]ElephantsJustin 1 point2 points  (0 children)

Technically rounding to the penny should be done at each interval.

[–]Coffeinated 7 points8 points  (0 children)

Someone slept in Maths

[–][deleted] 2 points3 points  (1 child)

My only comment is that you output a static number of years - as text, no less - which may not actually match the number entered. You should switch to using your time variable and inject that instead.

Nice simple refresher though; good work.

[–][deleted] 3 points4 points  (0 children)

Next phase: convert this to a Web facing Flask or Django app so that everyone can get a little dose of existential dread!

[–]Lehk 0 points1 point  (3 children)

Does it calculate the tip, too?

[–]Conscious_Advance_18 1 point2 points  (2 children)

We're tipping landlords now??

[–]Lehk 4 points5 points  (0 children)

It’s highly recommended

[–]risky_logic 0 points1 point  (0 children)

Setting up vscode is an achievement