|     |     |
| --- | --- |
| 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>18<br>19<br>20<br>21<br>22<br>23<br>24<br>25<br>26<br>27<br>28<br>29<br>30<br>31<br>32<br>33 | `<pre>``def``calendar(n, s):`<br>`#this will convert string value to a corresponding integer`<br>```if``s``=``=``"Su"``:`<br>```d``=``0`<br>```elif``s``=``=``"Mo"``:`<br>```d``=``1`<br>```elif``s``=``=``"Tu"``:`<br>```d``=``2`<br>```elif``s``=``=``"We"``:`<br>```d``=``3`<br>```elif``s``=``=``"Th"``:`<br>```d``=``4`<br>```elif``s``=``=``"Fr"``:`<br>```d``=``5`<br>```elif``s``=``=``"Sa"``:`<br>```d``=``6`<br>```print``(``"Su Mo Tu We Th Fr Sa"``)`<br>```for``j``in``range``(d):`<br>```print``(``" ``, end``=``" "``),`<br>```i``=``1`<br>```while``i <``=``n:`<br>```if``i <``10``:`<br>```print``("``",i,end="``"),`<br>```else``:`<br>```print``(i,end``=``" "``),`<br>```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>` |
