Advertisement
teslariu

plantillas y otras yerbas

Aug 22nd, 2023
892
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. Script que calcula el costo total de un préstamo
  6.  
  7. print("Simulador de préstamos:")
  8. c = int(input("Ingrese el capital inicial: "))
  9. x = int(input("Ingrese la tasa de interés: "))
  10. n = int(input("Ingrese la cantidad de años: "))
  11.  
  12. costo_total = c * (1 + x/100)**n
  13.  
  14. print(f"El costo total es ${costo_total:.2f}")
  15. """
  16. while True:
  17.     print("""
  18.     Menu de opciones
  19.     ----------------
  20.     1. Simular préstamo
  21.     2. Salir
  22.     -------------------
  23.     """)
  24.    
  25.     opcion = input("Seleccione su opción: ")
  26.    
  27.     if opcion == "1":
  28.         c = int(input("Ingrese capital inicial : "))
  29.         x = int(input("Ingrese tasa de interes:  "))
  30.         n = int(input("Ingrese numero de años : "))
  31.         costo_total = c * (1 + x / 100) ** n
  32.         print(f"El costo total del prestamo es : {costo_total:.2f}")
  33.  
  34.     elif opcion == "2":
  35.         print("Adios...")
  36.         break
  37.        
  38.     else:
  39.         print("Opción incorrecta..")
  40.  
  41. """
  42. if c <= 0 or x <= 0 or n <= 0:
  43.     print("Error valor negativo, ingresar valor valido")
  44. else:
  45.     print(f"El costo total del prestamo es : {costo_total:.2f}")
  46. """
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement