Skip to content

Commit 110ec2a

Browse files
15
1 parent c8da59f commit 110ec2a

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

Diff for: 15.py

+8-25
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,14 @@
1-
import datetime
1+
from calendar import isleap
2+
from datetime import date
3+
24

35
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)
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

3013
if __name__ == "__main__":
3114
main()

Diff for: README.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
# pythonchallenge
22
Solve 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
519
result: http://www.pythonchallenge.com/pc/return/uzi.html
620
```

0 commit comments

Comments
 (0)