File tree 2 files changed +22
-25
lines changed
2 files changed +22
-25
lines changed Original file line number Diff line number Diff line change 1
- import datetime
1
+ from calendar import isleap
2
+ from datetime import date
3
+
2
4
3
5
def main ():
4
- for i in range (100 ):
5
- s = "1"
6
- if i < 10 :
7
- s += "0"
8
- s += str (i )
9
- s += "6"
10
- year = int (s )
11
- if leap (year ):
12
- d = datetime .datetime (year , 1 , 27 ).strftime ("%w" )
13
- if d == "2" :
14
- print (year )
6
+ Tuesday = 1
7
+ for year in range (1006 , 1997 , 10 ):
8
+ d = date (year , 1 , 27 )
9
+ if isleap (year ) and d .weekday () == Tuesday :
10
+ print (d )
15
11
16
- def leap (year ):
17
- result = False
18
- if year % 4 == 0 :
19
- if year % 100 == 0 :
20
- if year % 400 == 0 :
21
- result = True
22
- else :
23
- result = False
24
- else :
25
- result = True
26
- else :
27
- result = False
28
- return result
29
12
30
13
if __name__ == "__main__" :
31
14
main ()
Original file line number Diff line number Diff line change 1
1
# pythonchallenge
2
2
Solve Problems in http://www.pythonchallenge.com
3
3
4
+ #### 15
5
+ result: http://www.pythonchallenge.com/pc/return/mozart.html
6
+
7
+ ``` python
8
+ from calendar import isleap
9
+ from datetime import date
10
+ ```
11
+
12
+ - year 1756 is a leap year
13
+ - 1756-1-27 is Tursday
14
+ - mozart's birthday is 1756-1-27
15
+ - mozart is the second youngest boy in his family
16
+
17
+
4
18
#### 14
5
19
result: http://www.pythonchallenge.com/pc/return/uzi.html
6
20
```
You can’t perform that action at this time.
0 commit comments