daysOfTheWeek=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
monthDic={"March":1,"April":2,"May":3,"June":4,"July":5,"August":6,"September":7,"October":8,"November":9,"December":10,"January":11,"February":12}
#def findDay(monthvalue,day,yearInt,century):
def main():
day=int(input("Enter the day of your date"))
month=input("enter the month of your date")
monthvalue=monthDic[month]
year=int(input("enter the year of your date"))
century=int(year)//100
yearInt=int(year)%100
varA=(13*monthvalue-1)/5
if(month=="January"or month=="February"):
year=int(year)-1
varB=int(year)/4
varC=int(century)/4
varD=int(varA)+int(varB)+int(varC)+int(day)+int(year)-2*int(century)
varE=int(varD)%7
if(varE<0):
varE=int(varE)+7
days=str(daysOfTheWeek[int(varE)-1])
print("days of the week is",daysOfTheWeek.index(days))
findDay(monthvalue,day,yearInt,century)
main()
为什么老说 findDay not defined?
monthDic={"March":1,"April":2,"May":3,"June":4,"July":5,"August":6,"September":7,"October":8,"November":9,"December":10,"January":11,"February":12}
#def findDay(monthvalue,day,yearInt,century):
def main():
day=int(input("Enter the day of your date"))
month=input("enter the month of your date")
monthvalue=monthDic[month]
year=int(input("enter the year of your date"))
century=int(year)//100
yearInt=int(year)%100
varA=(13*monthvalue-1)/5
if(month=="January"or month=="February"):
year=int(year)-1
varB=int(year)/4
varC=int(century)/4
varD=int(varA)+int(varB)+int(varC)+int(day)+int(year)-2*int(century)
varE=int(varD)%7
if(varE<0):
varE=int(varE)+7
days=str(daysOfTheWeek[int(varE)-1])
print("days of the week is",daysOfTheWeek.index(days))
findDay(monthvalue,day,yearInt,century)
main()
为什么老说 findDay not defined?
