2.1 答案改正

1. 有两处`date`拼写错误,错写成`data`,导致error。
2. 另外,某个日期是一年的第几天应该是那个日期减去新年的日期。从`date2-date1`改成`date1-date2`。
3. `date1-date2`不可以之间在括号内`+1`,因为datatype不同,把`+1`拿到外面
master
Windy 2019-03-03 21:02:39 -05:00 committed by GitHub
parent 1d1bd177e8
commit 74ca5d45e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -323,9 +323,9 @@
year = input("请输入年份: ") year = input("请输入年份: ")
month = input("请输入月份: ") month = input("请输入月份: ")
day = input("请输入天: ") day = input("请输入天: ")
date1 = datetime.data(year=int(year),month=int(month),day=int(day)) date1 = datetime.date(year=int(year),month=int(month),day=int(day))
date2 = datatime.date(year=int(year),month=1,day=1) date2 = datetime.date(year=int(year),month=1,day=1)
return (date2-date1 +1).days return (date1-date2).days+1
``` ```
## 2.2 打乱一个排好序的list对象alist ## 2.2 打乱一个排好序的list对象alist
``` ```