oddperiod.py

Created by ews31415

Created on November 16, 2021

545 Bytes

Payment on a monthly loan with an partial first period (0 to 59 days). The cash flow convention is used.

Source: HP 17BII+ Financial Calculator User’s Guide. Ed. 2. Hewlett Packard. San Diego, CA 2004


# 2021-11-14 EWS
# odd period

from math import *

print("Loan with partial period")
print("0 - 59 days")
print("Monthly Payments")
n=float(input("N: n? "))
rate=float(input("I/YR:  rate? "))
pv=float(input("PV: loan amt? "))
fv=float(input("FV: balooon pmt? "))
days=float(input("DAYS: odd period? "))

r=rate/1200

if days<30:
  j=1+r
else:
  j=1

f=days/30-int(days/30)
w=r*f+1
  
# uspv
u=(1-(1+r)**(-n))/r
# sppv
s=(1+r)**(-n)


pmt=(pv*w+fv*s)/(j*u)
# rounding
pmt=-int(pmt*100+.5)/100
# result
print("Payment: "+str(pmt))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.