Personal I have a job in which I should reproduce the following table: IdonothavemuchknowledgeinpythonandI'mdoingmybesttotrytoreproduceit.ButI'monlyabletoreturnthisway. Mydoubtsareasfollows:
Hereismycodebelow:
#enconding:utf-8#########################################VERSÃOUTILIZADA:Python3.6.5##DISCIPLINA:IntroduçãoàProgramação###################################################################################Informaçõesdeentradadadapelouser##########################################importosvalor_financiamento=float(input("1. Informe o valor a ser financiado: "))
os.system("cls")
prazo = int ( input ("2. Informe o prazo de quitação do financiamento (em meses): "))
os.system("cls")
taxa_juros_anual = float (input ("3. Informe a taxa de juros anual (em %): "))
os.system("cls")
# Início da programação e cálculo
# USO DO SISTEMA SAC
# O cálculo da amortização é realizado pelo valor do financiamento divido pela quantidade de meses
amortizacao = valor_financiamento / prazo
saldo_devedor = valor_financiamento - amortizacao
taxa_mensal = taxa_juros_anual / prazo
juros_mes = (taxa_juros_anual - 1 + 1 ) * amortizacao * taxa_mensal
prestacao = amortizacao + juros_mes
#valor_financiamento = str (valor_financiamento).replace('.',',')
#print ("AMORTIZAÇÃO: R$ %.2f" % amortizacao)
#print ("VALOR DO FINANCIAMENTO: R$ %.2f\n\n" % valor_financiamento)
print ("\t FINANCIAMENTO = R$ %.2f \t MESES: %i meses \t TAXA: %i%% ano (%.f%)" % (valor_financiamento, prazo, taxa_juros_anual, juros_mes))
print ("\t","-"*80,"\n")
print ("\t MÊS\tSALDO INICIAL\tPRESTAÇÃO\tAMORTIZAÇÃO\tJUROS\tSALDO FINAL")
print ("\t ---\t-------------\t---------\t-----------\t-----\t-----------")
print ("\t%4.i \t %12.2f \t\t\t %10.2f" % (prazo, valor_financiamento, amortizacao))
for p in range(prazo):
while (valor_financiamento > 1):
valor_financiamento = valor_financiamento - amortizacao # Saldo devedor
prazo = prazo - 1 # Referência do mês
saldo_devedor = valor_financiamento - amortizacao
saldo_final = saldo_devedor - amortizacao
print ("\t%4.i \t %12.2f \t\t\t %10.2f" % (prazo, valor_financiamento, amortizacao)) #% valor_financiamento)
#print (prazo)
This issue is a matter of real estate financing under the SAC system:
Question
Construct a program that generates a table of the monthly installments of a loan, detailing the amortization and interest payments to be paid up to the full amortization of the financing. This program should present a menu of options and ask the following information to the user: Amount financed, Term (in months) for discharge of the financing, Annual interest rate (in percentage) and Systematic monthly payment of installments (Constant Amortization System - SAC or PRICE system - see attached explanatory note). Additional features are welcome!
The amount of a loan must be repaid (amortized) to the lender within a certain period of time, plus interest. Amortizing means reducing the value of the debt, that is, paying a portion of the debt periodically so that it reduces in size until its elimination. As the debt implies interest collection, to repay it it is necessary that the benefit be greater than the interest charged in each period, that is, AMORTIZATION = PAYMENT - INTEREST (the amortized amount is what is left over after discounting the interest) . Interest only levied on the debit balance, where DEBT BALANCE = INITIAL DEBT - AMORTIZED AMOUNT. The ways to amortize financing are called "Amortization Systems".
Constant Amortization System (SAC): In this system, the balance due is repaid periodically in equal amortization amounts. In this way, the value of benefits is decreasing, since interest rates decrease for each benefit. The amortization value is calculated by dividing the principal amount (value of the financing) by the number of payment periods, that is, of installments. Thus,
Amount of amortization: AMORTIZATION = MAIN / N
• Interest rate in month T: JUROST = (N - T + 1) * AMORTIZATION * RATE
Value of the portion in T: PERFORMANCE = AMORTIZATION + JUROST
where: PRINCIPAL is the amount of the financing, N is the number of months of the financing, T denotes the month in question and RATE is the monthly interest rate (which must be obtained from the annual rate).
If someone can help me at least with logic. It's a great start.