Skip to content

Instantly share code, notes, and snippets.

@kassane
Last active July 30, 2019 12:15
Show Gist options
  • Save kassane/6a7ad6c0c4a3f5f938ca1720fa925506 to your computer and use it in GitHub Desktop.
Save kassane/6a7ad6c0c4a3f5f938ca1720fa925506 to your computer and use it in GitHub Desktop.
Calculando juros simples no Python 3
'''
_____________________________________________________________________________
| Juros Simples (PV=Valor Presente, FV=Valor Futuro, tax=%, men=mensalidade |
-----------------------------------------------------------------------------
'''
from math import pow
def PV(tax, men):
return pow(tax/100 + 1, men)
def FV(valor, pv):
return float(f'{valor * pv:.6}')
if __name__ == '__main__':
valor = float(input('Digite o valor R$: '))
taxa = int(input('Digite a taxa (%): '))
m = int(input('Digite a mensalidade[mensal]: '))
print(f'\nO valor futuro à pagar anualmente:')
for i in range(1,m+1):
juros = FV(valor,PV(taxa,i))
print(f'valor por período {i}: R$ {juros}.')
print(f'O valor é de R$ {valor} e a taxa de juros é {taxa}%!\n')
print(f'Resultado do juros à pagar R$: {juros} em {m} meses.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment