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
<pre>``def``calendar(n, s):
#this will convert string value to a corresponding integer
if``s``=``=``"Su"``:`<br>d=0<br>```elif``s``=``=``"Mo"``:
d``=``1`<br>elifs=="Tu":`<br>```d=2`<br>```elifs=="We":<br>```d``=``3
elif``s``=``=``"Th"``:`<br>d=4<br>```elif``s``=``=``"Fr"``:
d``=``5`<br>elifs=="Sa":`<br>```d=6`<br>```print("Su Mo Tu We Th Fr Sa")<br>```for``j``in``range``(d):
print``(``" ``, end``=``" "``),`<br>i=1<br>```while``i <``=``n:
if``i <``10``:`<br>print("",i,end=""),`<br>```else:<br>```print``(i,end``=``" "``),
if``(i``+``d)``%``7``=``=``0``:`<br>print(" ")`<br>```i=i+1`<br>`n=int(input("Input the number of days in the month (28-31): "))<br>s=input("Input the starting day (Su=Sun, Mo=Mon,...): ")`<br>`calendar(n,s)</``pre>`