Created
October 20, 2021 21:49
-
-
Save TrevCan/45eb27932543c678647ca76cd63404b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
# programa del dia siguiente | |
# debera verificar fechas y mostrar | |
# la fecha del dia siguiente. | |
dia=int ( input("Indicar dia:\t") ) | |
while dia < 1 or dia > 31: | |
print("Fecha Incorrecta.\nError, dia no esta en rango correcto...") | |
dia=int ( input("Indicar dia:\t") ) | |
mes=int ( input ("indicar mes:\t" ) ) | |
while mes<1 or mes>12 : | |
print("Fecha Incorrecta.\nMes fuera de rango") | |
mes=int ( input ("indicar mes:\t" ) ) | |
anio=int(input("indicar ano:\t") ) | |
while anio < 1900: | |
print("Fecha Incorrecta.\nerror, ano debe ser al menos 1900...\t") | |
anio=int(input("indicar ano:\t") ) | |
if mes==2 and dia > 29: | |
print("Fecha Incorrecta.\nFebrero solo tiene 29 dias...\t") | |
elif (mes==4 or mes==6 or mes==9 or mes==11) and dia > 30: | |
print("Fecha Incorrecta.\nEl mes ", mes, " tiene como maximo 30 dias...") | |
else: | |
dia=dia+1 | |
if dia==32: | |
mes= mes + 1 | |
dia = 1 | |
elif (mes==4 or mes==6 or mes==9 or mes==11) and dia == 31: | |
mes+= 1 | |
dia=1 | |
elif dia >= 28 and mes==2: | |
mes+=1 | |
dia=1 | |
if mes==13: | |
mes = 1 | |
anio+=1 | |
fecha=str(dia)+"/"+str(mes)+"/"+str(anio) | |
print(fecha) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment