Advertisement
teslariu

ifelif

Jan 21st, 2022
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # En Python, existen solo 3 estructuras lógicas:
  5. # 1 condicional (if-else)
  6. # 2 bucles (while, for)
  7.  
  8. # condicional con dos opciones:
  9. """
  10. Script que le pide el numero de mes y devuelve el cuatrimestre
  11. mes 1,2,3,4: primer cuatrimestre
  12. mes 5 6 7 8: segundo
  13. 9 10 11 12 tercero
  14. """
  15.  
  16. mes = int(input("Ingrese el nro de mes (1 enero, 2 febrero, etc): "))
  17.  
  18. if 1 <= mes <= 4:
  19.     print("Primer cuatrimestre")
  20.    
  21. elif 5 <= mes <= 8:
  22.     print("Segundo cuatrimestre")
  23.    
  24. elif 9 <= mes <= 12:
  25.     print("Tercer cuatrimestre")
  26.    
  27. else:
  28.     print("Número de mes incorrecto...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement