Calculating mortgage interest in Python

后端 未结 6 690
轻奢々
轻奢々 2020-12-31 17:46

I am currently learning python through a video tutorial on youtube, and have come up against a formula I cannot seem to grasp, as nothing looks right to me. The basic conc

6条回答
  •  独厮守ぢ
    2020-12-31 18:01

    This worked pretty well for me. Not exact, as loan calculators usually go by days, and I'm lazy so I go by months but here's a simple one I wrote that is accurate enough to be practical.

    L = input("How much will you be borrowing? ")
    L = float(L)
    print(L)
    
    
    N = input("How many years will you be paying this loan off? ")
    N = float(N) *12
    print(N)
    
    I = input("What is the interest in percents that you will be paying? Ex, 10% = 10, 5% = 5, etc. ")
    I = float(I)/100
    print(I)
    
    M = (L/N) + I*(L/N)
    
    float(M) 
    print("Your monthly payment will be: ")
    print(M)
    

提交回复
热议问题