-
Notifications
You must be signed in to change notification settings - Fork 0
/
coding_test20190910.py
53 lines (51 loc) · 1.22 KB
/
coding_test20190910.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
n = list(input().split())
for i in n:
for j in n:
for k in n:
print(i+j+k)
#wip
# N = int(input())
# x = list(input().split())
# a = ""
#
#
# def mixChar(N, a):
# if N > 0:
# for i in x:
# a = a + i
# mixChar(N-1, a)
#
#
# mixChar(N, a)
#
# re = [a[i: i+N] for i in range(0, len(a), N)]
# print(re)
import calendar
import datetime
y, m = map(int, input().split("/"))
firstDay = 1
lastDay = calendar.monthrange(y,m)[1]
print(str(y) + "/" + str(m).zfill(2))
week = ["" for i in range(7)]
for i in range(firstDay,lastDay+1):
stry = str(y)
strm = str(m)
strd = str(i).zfill(2)
day = "%s/%s/%s"%(stry,strm,strd)
a = datetime.datetime.strptime(day, '%Y/%m/%d')
weekday = a.weekday()
for j in range(7):
if weekday == j:
if weekday == 5:
week[j] = "[" + str(i).rjust(2) + "]"
elif weekday == 6:
week[j] = "(" + str(i).rjust(2) + ")"
print(" ".join(week))
week = ["" for i in range(7)]
else:
week[j] = str(i).rjust(2)
else:
if not week[j]:
week[j] = " "
if i == lastDay:
print(" ".join(week))