LearnPy Hub
← Introduction & print() problems
Hard

Print a Month Calendar

Read the weekday the month starts on (0 = Sunday … 6 = Saturday) and the number of days. Print the header Su Mo Tu We Th Fr Sa, then the days in weeks, each day right-aligned in width 2 and separated by one space, with blank cells before day 1. No trailing spaces.

Input

Two integers.

Output

Several lines.

Sample 1

Input
0
30
Output
Su Mo Tu We Th Fr Sa
 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

Sample 2

Input
3
31
Output
Su Mo Tu We Th Fr Sa
          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
solution.py
Output appears here
Print a Month Calendar · Python practice problem · LearnPy Hub