- 追加された行はこの色です。
- 削除された行はこの色です。
[[問題文>練習問題#i5e3e061]]
import sys
from calendar import *
from datetime import *
y = int(raw_input('input year: '))
m = int(raw_input('input month: '))
from calendar import monthrange, weekday
y = int(input('input year: '))
m = int(input('input month: '))
w = ' Mo Tu We Th Fr Sa Su'
D = monthrange(y, m)[1] # last day of the month
F = weekday(y, m, 1)
s = ' ' * F + ' ' + ' '.join(map(str,range(1, 10))) + ' ' + ' '.join(map(str,range(10,D+1)))
sys.stdout.write(w)
s = ' ' * (F+1) + ' '.join(map(str,range(1, 10))) + ' ' + ' '.join(map(str,range(10, D+1)))
print(w, end='')
for i, e in enumerate(s):
sys.stdout.write(e)
if i % len(w) == 0: print
print(e, end='\n' if i % len(w) == 0 or (i+1) == len(s) else '')