Спасибо за вашу помощь, я смог сделать это лучше, но не смог опубликовать его, пока наши задания не будут оценены.
Вот что я сделал:
from math import floor
def calcExcelDate(Year, Month,Day):
Yr_Offset=Year-1900 #Determines year offset from starting point.
Early_Mnth_Correctn=int((14-Month)/12)
#Early month correction:makes the year have 14 months so the leap day is added at the end of the year
DateCorrector=(Yr_Offset)-(Early_Mnth_Correctn) #Corrects Date
MonthCorrector=Month+12*Early_Mnth_Correctn #Corrects Month
Leapyr_Calc=1+min(DateCorrector,0)+int(DateCorrector/4)-int(DateCorrector/100)+int ((DateCorrector+300)/400)
#calculates no of leap years since starting point
char=int(floor(-1.63+(MonthCorrector-1)*30.6))
#determines the number of days preceding the given month in a non leap year.
Excel_Date=(Day+DateCorrector*365+Leapyr_Calc+char )
Days=["Monday","Tuesday","Wednesday","Thursday","Friday","saturday","sunday"]
Months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
Offset=2
dayNo=(Excel_Date-Offset)%7
dayOfWk=Days[dayNo]
return "The excel date of %r %r-%r-%r is %r"%(dayOfWk,Day,Months[Month-1],Year,Excel_Date)