Changes

Jump to: navigation, search

OPS435 Assignment 1 for Section B

368 bytes added, 23:31, 8 October 2020
Tests and Test results
== Tests and Test results ==
You must name your python 3 script as <code>a1_[Student_idSeneca_name].py</code>. The following examples assumes that the student_id Seneca_name is rchan.The script should accept two one command line argumentsargument, the first one is the date argument can be either in "YYYYMMDD", "YYYY/MM/DD", "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 or "YYYY-.MM-.DD" format is broken. If the input data does not represent a real date, your script should give an appropriate error message. Invalid months (>12) or invalid days of month(different for each month, and if the month is February, the year matter too), should be detected and give appropriate error messages. For examples:* <b><code>python3 a1_rchan.py 012020-0110-2019 02-01-201910</code></b>, and the output should be<br /> 1Oct 10, 2020* <b><code>python3 a1_rchan.py 012020-0110-2019 31-12-201809</code></b>, and the output should be<br /> -1Oct 9, 2020* <b><code>python3 a1_rchan.py 012020-06-30</code></b>, and the output should be<br /> Jun 30, 2020* <b><code>python3 a1_rchan.py 20201010</code></b>, and since today is June 3the output should be<br /> Oct 10, 2020* <b><code>python3 a1_rchan.py 2020/10/10</code></b>, and the output should be<br /> 2 Oct 10, 2020* <b><code>python3 a1_rchan.py 01-01-2019 01-01-2020.02.29</code></b>, and the output should be<br /> 365Feb 29, 2020* <b><code>python3 a1_rchan.py 01-01-2021 01-01-2020 2019.02.28</code></b>, and the output should be<br /> -366Error 03: wrong day entered* <b><code>python3 a1_rchan.py 01-2019.13-2018.12</code></b>, and the output should be<br /> Error02: wrong month entered* <b><code>python3 a1_rchan.py 99-01-2020 01-01-20202019.06.31</code></b>, and the output should be<br /> Error03: wrong day entered* <b><code>python3 a1_rchan.py 2018 2201802</code></b>, and the output should be<br /> Error09: wrong date entered* <b><code>python3 a1_rchan.py 18981225</code></b>, and the output should be <br /> Error 10: year out of range, must be 1900 or later* <b><code>python3 a1_rchan.py 18981299</code></b>, and the output should be <br /> Error 10: year out of range, must be 1900 or later* <b><code>python3 a1_rchan.py 189802</code></b>, and the output should be<br /> Error 09: wrong data entered
 If there is too few or too many command line arguments argument given, display the proper usage:* <code>Usage: a1_rchan.py YYYYMMDD|YYYY/MM/DD|YYYY-MM-DD|YYYY [.MM.DD-MM-YYYY] >/code>
== Script structure and sample template ==
1,760
edits

Navigation menu