Advertisement
teslariu

contador

Dec 16th, 2021
993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # hacer un script que simule un contador en forma regresiva empezando
  5. # desde un valor ingresado por consola
  6. # ej:
  7. # >>> Ingrese un número entero mayor a cero: 5
  8. # >>> 5
  9. # >>> 4
  10. # >>> 3
  11. # >>> 2
  12. # >>> 1
  13. # >>> ¡BOOOMMM!
  14. # AYUDA: biblioteca time, función sleep ---> time.sleep
  15.        
  16. import time     # biblioteca para hacer el contador
  17.        
  18. tiempo = int(input("Ingrese un número entero mayor a cero: "))
  19.  
  20. for i in range(tiempo,0,-1):
  21.     time.sleep(1)
  22.     print(i)
  23. print("¡BOOOMMM!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement