Python compound interest calculator 💵

Поділитися
Вставка
  • Опубліковано 29 жов 2022
  • #Python #tutorial #course
    Python compound interest calculator tutorial example explained

КОМЕНТАРІ • 35

  • @BroCodez
    @BroCodez  Рік тому +24

    # 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}")

    • @atalgill5587
      @atalgill5587 11 місяців тому +2

      Why define the variables equal to zero?

    • @mohab4869
      @mohab4869 10 місяців тому +2

      @@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
    @arbjonmarasheviq6710 Рік тому +8

    OMG back from 3 months
    My fav teacher
    Keep going BRO

  • @tanh4219
    @tanh4219 Рік тому +8

    Make more machines like this please! It's so educating

  • @Afghanistanfutsalfans
    @Afghanistanfutsalfans Рік тому

    It has been a few days since having started watching your videos. you are the best!

  • @hemant6271
    @hemant6271 Рік тому +2

    thanks for explaining so nice the way you teach makes me more interested in your videos warm wishes from INDIA

  • @sunrise4439
    @sunrise4439 Рік тому

    Living legend Teacher... GBU Mr. Bro

  • @ahmadabdelmonem7692
    @ahmadabdelmonem7692 9 місяців тому

    Thanks BroCodez, You are the best!!!

  • @user-ly5we6xl4v
    @user-ly5we6xl4v 6 місяців тому

    NICELY DONE BRO...❤

  • @chrisbwelesi3243
    @chrisbwelesi3243 Рік тому

    Very interesting

  • @tripphouse8165
    @tripphouse8165 Рік тому +1

    Im actually making a compound interest app with future value of a series in JS for one of my portfolio projects : )

  • @chineduogoliegbune5227
    @chineduogoliegbune5227 10 місяців тому +1

    I think I prefer the 'While True' function in python, it's a lot easier to understand

  • @darkshadowgamer401
    @darkshadowgamer401 5 місяців тому +1

    Bro is Teaching Math secretly

  • @LordoofGaming1
    @LordoofGaming1 9 місяців тому +1

    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

  • @ItzSomething634
    @ItzSomething634 5 місяців тому

    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

  • @tara2337
    @tara2337 3 місяці тому +1

    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
      @AmaraMySon-ob8yy 6 днів тому

      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

  • @danielhod53
    @danielhod53 Рік тому +1

    hey Bro, what keyboard and mouse are you using?

    • @MrSwaga1
      @MrSwaga1 8 місяців тому +1

      I was thinking the same same thing because he was like clickety clack clack all the way through the video lol

  • @thecarzyguyyy9692
    @thecarzyguyyy9692 8 місяців тому

    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
    @mywhiteplume Рік тому +1

    How would we modify the rates to accept decimal values?

    • @rottenspilledbeans
      @rottenspilledbeans Рік тому +1

      The program accepts decimal values as long as you you have included float in the program instead of int.

    • @anvrag
      @anvrag 11 місяців тому +1

      instead of int, use float typecast.

  • @RaajaNaagaLingam
    @RaajaNaagaLingam Рік тому +1

    How did the system know how to calculate the interest?

  • @bjrn-magnekristensen2444
    @bjrn-magnekristensen2444 7 місяців тому

    my take on it:
    def intrest_calculator():
    principle = 0
    rate = 0
    time = 0
    while principle

  • @mustafarasool7591
    @mustafarasool7591 Рік тому

    hi , i did not get why you add true

  • @timashot3286
    @timashot3286 Рік тому +2

    wait, isn't the formula of compound interest p(1+r/n)^tn? but you did p(1+r)^t

    • @tommasotiberi5666
      @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
      @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

  • @isaiahlacuarin3653
    @isaiahlacuarin3653 Рік тому

    bro this is simple Interest

  • @RaajaNaagaLingam
    @RaajaNaagaLingam Рік тому +5

    It's Principal not Principle!

  • @Lit35
    @Lit35 5 місяців тому

    i hate math