Advertisement
teslariu

cuenta regresiva

May 20th, 2023
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Hacer un script que pida un tiempo y haga una cuenta regresiva y
  4. # simule una bomba
  5. # >>> Ingrese tiempo para la explosion: 4
  6. # 4
  7. # 3
  8. # 2
  9. # 1
  10. # BOOOM
  11. # ayuda: funcion time.sleep(1) Tengo que contar segundos --> repeticiones
  12. # definidas en cantidad --> ciclo for
  13. import time
  14.  
  15. tiempo = int(input("Ingrese tiempo para la explosión: "))
  16.  
  17. for t in range(tiempo,0, -1):  # tengo que hacer un contador decreciente
  18.     print(t)
  19.     time.sleep(1)
  20. print("BOOOM")
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement