Changes

Jump to: navigation, search

OPS435 Python Assignment 2 A

573 bytes added, 09:34, 10 July 2018
Program Name and valid command line arguments
= 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. There is an option called --step that makes the program print out all dates until the final date. Invalid months (>12) or invalid days of month(different for each month), should be detected and give appropriate messages. For examples:
* <b><code>python3 dbda.py 20180101 1</code></b>, and the output should be<br />
20180102
* <b><code>python3 dbda.py 20180101 2</code></b>, and the output should be<br />
20180103
* <b><code>python3 dbda.py --step 20180101 3</code></b>, and the output should be<br />
20180102
20180103
20180104
* <b><code>python3 dbda.py 20189901 2</code></b>, and the output should be<br />
Error: bad month entered
* <b><code>python3 dbda.py 20180199 2</code></b>, and the output should be<br />
Error: bad day entered
 
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 yesterday() and the other called tomorrow():
198
edits

Navigation menu