Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def anioB(anio):
- '''
- Determina si un año es bisiesto o no
- '''
- if anio % 4 is 0 and anio % 100 is not 0 or anio % 400 is 0:
- return True
- else:
- return False
- def diaSemana(anio,mes,dia):
- '''
- Calcula el día que cae un determinado día, de un mes, de un año
- '''
- digitos_siglo=anio//100
- digitos_año=anio%100
- valor=digitos_año + math.floor(digitos_año / 4)
- if digitos_siglo == 18:
- valor=valor+2
- elif digitos_siglo == 20:
- valor+=6
- anio_bisiesto=anioB(anio)
- if mes == "Enero" and anio_bisiesto == False:
- valor+=1
- elif mes == "Febrero" and anio_bisiesto:
- valor+=3
- elif mes == "Febrero" and anio_bisiesto == False:
- valor+=4
- elif mes == "Marzo" or mes == "Noviembre":
- valor+=4
- elif mes == "Mayo":
- valor+=2
- elif mes == "Junio":
- valor+=5
- elif mes == "Agosto":
- valor+=3
- elif mes == "Octubre":
- valor+=1
- elif mes == "Setiembre" or mes == "Diciembre":
- valor+=6
- valor=(valor+dia)%7
- if valor == 1:
- return "Domingo"
- elif valor==2:
- return "Lunes"
- elif valor==3:
- return "Martes"
- elif valor==4:
- return "Miércoles"
- elif valor==5:
- return "Jueves"
- elif valor==6:
- return "Viernes"
- elif valor==0:
- return "Sábado"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement