File tree Expand file tree Collapse file tree 2 files changed +22
-25
lines changed
Expand file tree Collapse file tree 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+
24
35def 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 )
1511
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
2912
3013if __name__ == "__main__" :
3114 main ()
Original file line number Diff line number Diff line change 11# pythonchallenge
22Solve Problems in http://www.pythonchallenge.com
33
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+
418#### 14
519result: http://www.pythonchallenge.com/pc/return/uzi.html
620```
You can’t perform that action at this time.
0 commit comments