Changes

Jump to: navigation, search

OPS435 Python Assignment 2 A

1,546 bytes added, 02:29, 29 March 2018
Overview
[[Category:OPS435-Python]][[Category:rchan]]
= Overview =
When making back up of data files or log files, it is a very common practice to name the backup directories and/or files based on the date the backup was done. In order to restore or locate the directory/file, we often need to find out the backup date from today's date.
 
The task for this assignment is to write a python program which will take a date in the "YYYYMMDD" format and the number of day before or after the given date as the command line arguments, and output the actual date which is the number of day before or after the given date in the same format.
 
= Instruction =
== Program Name and valid command line arguments ==
Name your python3 program as <code>dbda.py</code>. The program should accept two command line parameters, the first one is the date in "YYYYMMDD" format, and the second one is the number of day from the given date, a position value indicates the number of days after the given date, and a negative value indicates the number of days before the given date. For examples:
* <b><code>python3 dbda.py 20180101 1</code></b>, and the output should be<br />
20180102
* <b><code>python3 dbda.py 20180101 -1</code></b>, and the output should be<br />
20171231
* <b><code>python3 dbda.py 20180101 2</code></b>, and the output should be<br />
20180103
If there is too few or too many command line parameters given, display the proper usage.
== Program structure ==
Your program code should all be in a single python file with at least two functions, one called tomorrow() and the other called yesterday().
= Sample code for the tomorrow() function =
1,760
edits

Navigation menu