Alarma

# -*- coding: utf-8 -*- import time msgBienvenida="Bienvenidos a este ejercicio -*-alarma-*- ".title() print(msgBienvenida.center(60,"=")) Now=time.strftime('%-I:%M:%S %P').upper() print("hora actual: {0}".format(Now)) hora=int(input("por favor ingrese la hora:")) minuto=int(input("por favor ingrese el minuto:")) segundo=int(input("por favor ingrese el segundo:")) def horaUser(h,m,s): return "{0}{1}{2}".format(h,m,s) while(True): Now=time.strftime('%-I%M%S') if Now==horaUser(hora,minuto,segundo): print("¡BIIP! ¡BIIP!") break else: resta = int(horaUser(hora,minuto,segundo))-int(Now) print("Restan!: {0}".format(resta)) time.sleep(1)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.