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 simule un contador en forma regresiva empezando
- # desde un valor ingresado por consola
- # ej:
- # >>> Ingrese un número entero mayor a cero: 5
- # >>> 5
- # >>> 4
- # >>> 3
- # >>> 2
- # >>> 1
- # >>> ¡BOOOMMM!
- # AYUDA: biblioteca time, función sleep ---> time.sleep
- #
- # TICKET 1: validar que el tiempo ingresado sea válido
- import time # biblioteca para hacer el contador
- while True:
- tiempo = input("Ingrese un número entero mayor a cero: ")
- if tiempo.isdecimal():
- tiempo = int(tiempo)
- for i in range(tiempo,0,-1):
- time.sleep(1)
- print(i)
- print("¡BOOOMMM!")
- break
- print(f"Error: {tiempo} no es un entero mayor a cero")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement