Changes

Jump to: navigation, search

OPS435 Assignment 2 for Section C

1,800 bytes added, 18:02, 25 March 2021
Allowed Python Modules
* the <b>os, sys</b> modules
* the <b>argparse</b> module
* The <b>datetime</b> module, including datetime and timedelta.
* The <b>subprocess</b> module
** === Argparse ===Argparse is a much, much better way of dealing with command line arguments. It not only handles positional arguments, but options as well and will generate usage messages.It's <i>very highly recommended</i> that you spend at least a few minutes reading through the [https://docs.python.org/3/howto/argparse.html Argparse Tutorial] . === Datetime ===Since Python is a <i>batteries</i> included language, it's important to get accustomed with using some of the modules in the standard library. Since we are dealing with dates and times, you are required to work with the datetime module. The full docs can be found [https://docs.python.org/3/library/datetime.html here]. Datetime objects can be initialized from strings that match a particular format. One example is provided for you in the codebase: [https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime the strptime] function. Once you have created datetime objects, you can do useful things with them: * <code> d1 > d2 </code> will return True is d1 is <b>later</b> thank d2.* <code> d2 - should read d1 </code> will return a <i>timedelta</i> object, which is an amount of time between d2 and d1. More interesting methods are in the [https://docs.python.org/3/library/datetime.html#datetime.datetime.fold table] in the docs. === Timedelta ===When performing some operations with datetime objects, we may see timedelta objects being created. In math, <b>delta</b> refers to a difference. So a timedelta object is essentially an object that represents a duration. You can do useful things with timedelta objects:* <code> delta1 + delta2 </code> will add up two durations. For example, if delta1 is two hours and delta2 is three hours, then this firstoperation will return five hours.** <code> str(delta1) </code> will represent the timedelta in a friendly format: H:MM:SS if the duration is less than 24 hours.  More interesting methods are in the [https://docs.python.org/3/library/argparsedatetime.html Argparse API reference information page#datetime.datetime.fold table]in the docs.
== Instructions ==

Navigation menu