Changes

Jump to: navigation, search

OPS445 Online Assignment 1

254 bytes removed, 22:16, 29 September 2021
Tests and Test results
== Tests and Test results ==
You must name your python 3 script as <code>a1_[Student_id]assign1.py</code>. The following examples assumes that the student_id is rchan.The script should accept two command line arguments, the first one is the date in "YYYY-MM-DD" format, and the second one is the number of day from the given date, a positive 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 optional flag called --step which can be provided at the command line that makes the program print out all dates until the target date. If the "YYYY-MM-DD" format is broken, your script should give an appropriate error message. Invalid months (>12) or invalid days of month(different for each month), should be detected and give appropriate error messages. For examplesexample:* <b><code>python3 a1_rchanassign1.py 01-01-2019 02-01-20191</code></b>, and the output should be<br /> 102-01-2019* <b><code>python3 a1_rchanassign1.py 01-01-2019 31-12-20181</code></b>, and the output should be<br /> 31-112-2018* <b><code>python3 a1_rchanassign1.py 01-06-2020365</code></b>, and since today is June 3, the output should be<br /> 2 01-06-2021 * <b><code>python3 a1_rchanassign1.py 01-01-2019 01-01-2020365</code></b>, and the output should be<br /> 36501-01-2020* <b><code>python3 a1_rchanassign1.py 01-01-2021 01-01-2020 366 </code></b>, and the output should be<br /> 01-01-3662020* <b><code>python3 a1_rchanassign1.py 01-13-20181</code></b>, and the output should be<br />
Error: wrong month entered
* <b><code>python3 a1_rchanassign1.py 99-01-2020 01-01-20201</code></b>, and the output should be<br />
Error: wrong day entered
* <b><code>python3 a1_rchanassign1.py 2018 2</code></b>, and the output should be<br />
Error: wrong date entered
If there is too few or too many command line arguments given, display the proper usage:
* <code>Usage: a1_rchanassign1.py DD-MM-YYYY [DD-MM-YYYY] N >/code>
== Script structure and sample template ==

Navigation menu