Пример #1
0
def opcion2(f1):
    h2 = int(input('Hora para restar '))
    m2 = int(input('Minutos '))
    s2 = int(input('segundos '))
    f2 = FechaHora(0, 0, 0, h2, m2, s2)
    if (f2.getSeg() > f1.getSeg()):
        f1.aSeg()  #le suma 60 a los segundos y le resta 1 a los minutos#
    if (f2.getMin() >
            f1.getMin()):  #le suma 60 a los minutos y le resta 1 a la hora#
        f1.aMin()
    resta = f1 - f2
    resta.acomodaR()
    print(resta)
Пример #2
0
def opcion1(f1):
    h2 = int(input('Hora para sumar '))
    m2 = int(input('Minutos '))
    s2 = int(input('segundos '))
    f2 = FechaHora(0, 0, 0, h2, m2, s2)
    suma = f1 + f2
    suma.acomodar()  #Acomoda dia,mes y año en caso q supere las 24 hs#
    print('{}'.format(suma))
Пример #3
0
def opcion3(f1):
    h2 = int(input('Hora para comparar '))
    m2 = int(input('Minutos '))
    s2 = int(input('segundos '))
    f2 = FechaHora(0, 0, 0, h2, m2, s2)
    comp = f1 > f2
    if (comp == 1):
        print('La hora ingresada es menor')
    else:
        print('La hora ingresada es mayor a la primera')
Пример #4
0
        print("el mayor es:{}".format(b))


switcher = {0: opcion0, 1: opcion1, 2: opcion2, 3: opcion3}


def switch(argument, a, b):
    func = switcher.get(argument, lambda: print("Opción incorrecta"))
    func(a, b)


if __name__ == '__main__':
    bandera = False
    a = int(input("ingrese hora"))
    b = int(input("ingrese hora"))
    while a > 24 or b > 24:
        a = int(input("ingrese hora en formato 24h"))
        b = int(input("ingrese hora en formato 24h"))
    hora1 = FechaHora(1, 1, 2020, a, 0, 0)
    hora2 = FechaHora(1, 1, 2020, b, 0, 0)
    test = FechaHora(1, 1, 2020, 0, 0, 0)

    while not bandera:
        print("")
        print("0 Salir")
        print("1 sumar hora")
        print("2 restar hora2")
        print("3 distinguir mayor 3")
        opcion = int(input("Ingrese una opción: "))
        switch(opcion, a, b)
        bandera = int(opcion) == 0
Пример #5
0
    3: opcion3,
}


def switch(argumento, f1):
    func = switcher.get(argumento, lambda: print("Opción incorrecta"))
    func(f1)


if __name__ == '__main__':
    d = int(input("Ingrese Dia: "))
    mes = int(input("Ingrese Mes: "))
    a = int(input("Ingrese Año: "))
    h = int(input("Ingrese Hora: "))
    m = int(input("Ingrese Minutos: "))
    s = int(input("Ingrese Segundos: "))
    f1 = FechaHora(d, mes, a, h, m, s)
    bandera = 'falso'
    while bandera == 'falso':
        print('')
        print("      Menu")
        print(" 1 Sumar Hora")
        print(" 2 Restar Hora")
        print('  3 Mayor hora ')
        opcion = int(input("Ingrese una opción:"))
        switch(opcion, f1)
        op = (input('Desea Continuar? '))
        if (op == 'no'):
            bandera = 'verdadero'
            print("Adiós")
Пример #6
0
Файл: ej7.py Проект: Babsia/ej7
if __name__ == '__main__':

    d = int(input("Ingrese Dia: "))

    mes = int(input("Ingrese Mes: "))

    a = int(input("Ingrese Año: "))

    h = int(input("Ingrese Hora: "))

    m = int(input("Ingrese Minutos: "))

    s = int(input("Ingrese Segundos: "))

    f = FechaHora(d, mes, a, h, m, s)

    f.Mostrar()

    input()

    h1 = int(input("Ingrese Hora: "))

    m1 = int(input("Ingrese Minutos: "))

    s1 = int(input("Ingrese Segundos: "))

    r = Hora(h1, m1, s1)

    r.Mostrar()
Пример #7
0
 def __radd__(self, hora):
     return FechaHora(hora.getDia(), hora.getMes(), hora.getAño(),
                      self.__hora + hora.getHora(),
                      self.__minutos + hora.getMin(),
                      self.__segundos + hora.getSeg())
Пример #8
0
if __name__ == '__main__':

    d = int(input("Ingrese Dia: "))

    mes = int(input("Ingrese Mes: "))

    a = int(input("Ingrese Año: "))

    h = int(input("Ingrese Hora: "))

    m = int(input("Ingrese Minutos: "))

    s = int(input("Ingrese Segundos: "))

    r = FechaHora(
        1, 1, 2020, 0, 0,
        0)  #  inicilizar día, mes, año con 1/1/2020, y hora, minutos y

    #  segundos con 0h, 0m, 0s.

    r1 = FechaHora(d, mes, a, 0, 0, 0)
    # inicializar con 0h 0m 0s

    r2 = FechaHora(d, mes, a, h, m, s)

    r.Mostrar()

    r1.Mostrar()

    r2.Mostrar()
Пример #9
0
from clasefecha import FechaHora

if __name__ == '__main__':

    d = int(input("Ingrese Dia: "))

    mes = int(input("Ingrese Mes: "))

    a = int(input("Ingrese Año: "))

    h = int(input("Ingrese Hora: "))

    m = int(input("Ingrese Minutos: "))

    s = int(input("Ingrese Segundos: "))
    r = FechaHora()
    r1 = FechaHora(d, mes, a)
    r2 = FechaHora(d, mes, a, h, m, s)
    r.Mostrar()
    r1.Mostrar()
    r2.Mostrar()
    input()
    r.PonerEnHora(5)
    r.Mostrar()
    input()
    r2.PonerEnHora(13, 30)
    r2.Mostrar()
    input()
    r.PonerEnHora(14, 30, 25)
    r.Mostrar()
    input()