String Manipulation

Assignment

Problem: Write a Python program that basically imitates the output of the Unix cal command, for the current month, assuming it's 2006 (2006 is not a leap year). Thus, if the current month is Feb 2006, I want the program to give me:

   February 2006
 S  M Tu  W Th  F  S
          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

For input, accept the month and the day of the week the first falls on. (There's an algorithm to calculate that, but that will make the assignment more complicated than is appropriate at this time.) Also make the program executable, i.e., all you have to do is type the name of the file at the Unix command line to run it (details on doing this are found here as well as here). Finally, you might want to look up the sys module in Python, with particular attention to the argv attribute.

Solution

See the following web page.

Creative Commons License Updated: Friday, 24-Dec-2010 08:44:03 PST. Valid CSS, HTML. Author: Johnny Lin <email address>. Disclaimer. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike License.