Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- Script que calcula el costo total de un préstamo
- print("Simulador de préstamos:")
- c = int(input("Ingrese el capital inicial: "))
- x = int(input("Ingrese la tasa de interés: "))
- n = int(input("Ingrese la cantidad de años: "))
- costo_total = c * (1 + x/100)**n
- print(f"El costo total es ${costo_total:.2f}")
- """
- while True:
- print("""
- Menu de opciones
- ----------------
- 1. Simular préstamo
- 2. Salir
- -------------------
- """)
- opcion = input("Seleccione su opción: ")
- if opcion == "1":
- c = int(input("Ingrese capital inicial : "))
- x = int(input("Ingrese tasa de interes: "))
- n = int(input("Ingrese numero de años : "))
- costo_total = c * (1 + x / 100) ** n
- print(f"El costo total del prestamo es : {costo_total:.2f}")
- elif opcion == "2":
- print("Adios...")
- break
- else:
- print("Opción incorrecta..")
- """
- if c <= 0 or x <= 0 or n <= 0:
- print("Error valor negativo, ingresar valor valido")
- else:
- print(f"El costo total del prestamo es : {costo_total:.2f}")
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement