#Python #tutorial #course Python compound interest calculator tutorial example explained
Пікірлер: 35
@BroCodez Жыл бұрын
# Python compound interest calculator principle = 0 rate = 0 time = 0 while True: principle = float(input("Enter the principle amount: ")) if principle < 0: print("Principle can't be less than zero") else: break while True: rate = float(input("Enter the interest rate: ")) if rate < 0: print("Interest rate can't be less than zero") else: break while True: time = int(input("Enter the time in years: ")) if time < 0: print("Time can't be less than zero") else: break total = principle * pow((1 + rate / 100), time) print(f"Balance after {time} year/s: ${total:.2f}")
@atalgill558710 ай бұрын
Why define the variables equal to zero?
@mohab486910 ай бұрын
@@atalgill5587 Because if we didn't put these variables before the while loop except (while True) python will give us an error cuz its not defined before , so we put these variables before it with zero value and user will overwrite the zero I hope that was useful :)
@arbjonmarasheviq6710 Жыл бұрын
OMG back from 3 months My fav teacher Keep going BRO
@tanh4219 Жыл бұрын
Make more machines like this please! It's so educating
@afghanlearners9505 Жыл бұрын
It has been a few days since having started watching your videos. you are the best!
@hemant6271 Жыл бұрын
thanks for explaining so nice the way you teach makes me more interested in your videos warm wishes from INDIA
@sunrise4439 Жыл бұрын
Living legend Teacher... GBU Mr. Bro
@ahmadabdelmonem76928 ай бұрын
Thanks BroCodez, You are the best!!!
@tripphouse8165 Жыл бұрын
Im actually making a compound interest app with future value of a series in JS for one of my portfolio projects : )
@user-ly5we6xl4v6 ай бұрын
NICELY DONE BRO...❤
@chrisbwelesi3243 Жыл бұрын
Very interesting
@chineduogoliegbune52279 ай бұрын
I think I prefer the 'While True' function in python, it's a lot easier to understand
@ItzSomething6345 ай бұрын
i wish he wrote out the exercise with a rough guide on how to do the questions before we watch the video instead of just walking us through it straight away
@LordoofGaming18 ай бұрын
can you hulp ? with coding a program based on standard value table loan interest rate, initial initial value basic installment values you will calculate the value received in each subsequent for the next 2 years plss
@darkshadowgamer4015 ай бұрын
Bro is Teaching Math secretly
@tara23373 ай бұрын
great job man! thank you so much! I just don't get why you use an if inside a while loop with the same condition, well, if we get inside the while loop, it's obvious that the condition is true and we won't need to check it again by using the if function🤔
@AmaraMySon-ob8yyКүн бұрын
Exactly. Can't we just print the warning inside the while loop and then give the user a chance to leave the loop by repeating the initial function? If you get what I mean
@bjrn-magnekristensen24447 ай бұрын
my take on it: def intrest_calculator(): principle = 0 rate = 0 time = 0 while principle
@danielhod53 Жыл бұрын
hey Bro, what keyboard and mouse are you using?
@MrSwaga18 ай бұрын
I was thinking the same same thing because he was like clickety clack clack all the way through the video lol
@thecarzyguyyy96927 ай бұрын
I dont really understand the While True code, isn't 0 False? And what does it based to be True? pls explain to me thx.🙏🙏🙏🙏
@mywhiteplume Жыл бұрын
How would we modify the rates to accept decimal values?
@rottenspilledbeans Жыл бұрын
The program accepts decimal values as long as you you have included float in the program instead of int.
@anvrag11 ай бұрын
instead of int, use float typecast.
@RaajaNaagaLingam Жыл бұрын
How did the system know how to calculate the interest?
@rottenspilledbeans Жыл бұрын
Because you program it to calculate compound interest.
@mustafarasool7591 Жыл бұрын
hi , i did not get why you add true
@rottenspilledbeans Жыл бұрын
true here means the value is not negative.
@timashot3286 Жыл бұрын
wait, isn't the formula of compound interest p(1+r/n)^tn? but you did p(1+r)^t
@tommasotiberi5666Ай бұрын
That's right, the formula has 'n' (number of times interest is compounded per year) at the exponent as well...then he just deals with the case n=1 since it's yearly interest: weekly interest would be with n=52, daily with n=365, monthly with n=12, ecc...
@tommasotiberi5666Ай бұрын
Btw the factor 100 he has at the denominator in the line where he defines the total comes from the percentage conversion: if R=3% then r=R/100=0.03