Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # Hacer un script que pida un numero e implemente una cuenta regresiva
- # desde ese nro hasta cero
- # ayuda: función time.sleep()
- # el tiempo debe ser mayor a cero, entonces voy a validar con isdecimal
- import time
- while True:
- numero = input("Ingrese una cantidad de segundos: ")
- if numero.isdecimal():
- numero = int(numero)
- break
- else:
- print("Debe ingresar un nro entero mayor a cero")
- # cuenta regresiva
- for tiempo in range(numero,0,-1):
- print(tiempo)
- time.sleep(1)
- print("BOOMMMMM")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement