我必须写numDays(otherdate)
函数返回的天数,因为这日期和OtherDate之间的正整数。公历日期,NUMDAYS功能
此功能属于类Date ADT是初始化为给定的阳历日子。格式为self._date(month,day,year)
格式。它必须两者之间的差异返回dates.like 9月25日和10月6日=有12天差异
def numDays(self,otherDate):
print("Enter a date:")
y=int(input("Year:"))
m=int(input("Month:"))
d=int(input("Day:"))
today=self._date(y,m,d)
diff=today-otherDate
NoOfDays=diff.days
print("The Number of day between today and Julian date is %s"%NoOfDays)
写这样的,但我知道有一些失误。
看起来你要我们写一些代码给你。尽管许多用户愿意为遇险的编码人员编写代码,但他们通常只在海报已尝试自行解决问题时才提供帮助。证明这一努力的一个好方法是包含迄今为止编写的代码,示例输入(如果有的话),期望的输出和实际获得的输出(控制台输出,堆栈跟踪,编译器错误 - 无论是适用)。您提供的细节越多,您可能会收到的答案就越多。 –
@MartijnPieters - 我正要写些东西来达到这个效果......你是否打开这个文本文件,你可以在这里复制/粘贴:-P – mgilson
@mgilson:[AutoReviewComments-Pro-forma comments为SE](http://stackapps.com/q/2116)为胜利。 –