Skip to main content
SciNet
  • Home
  • All Courses
  • Calendar
  • Certificates
  • SciNet
    Main Site Documentation my.SciNet
  • CCDB
  • More
Close
Toggle search input
English
English Français
You are currently using guest access
Log in
SciNet
Home All Courses Calendar Certificates SciNet Collapse Expand
Main Site Documentation my.SciNet
CCDB
Expand all Collapse all
  1. Dashboard
  2. EES1137 - Winter 2022
  3. Assignment 9

Assignment 9

Completion requirements
Opened: Thursday, 17 March 2022, 11:30 AM
Due: Thursday, 24 March 2022, 11:59 PM

Due date: Thursday, March 24th at midnight.


Be sure to use version control ("git"), as you develop your code. Do "git add ...., git commit" repeatedly as you add and edit your code. You will hand in the output of "git log" for your assignment repository as part of the assignment.


1) In this assignment we ask you to take the Assignment 3 and re-implement it using Python instead of R. Use the same file name, except change the extension to ".py" instead of ".R".

2) Create a Python script, named `selectStat.py`, which:

  • Imports the file `myFuncs.py`;
  • Creates an array `mydata` containing the values `-10.0, -3.0, 2.0, 0.0, 4.0, 5.0, 0.3, -0.1, 2.1, 3.2, 0.0, -12.1, -1.2`;
  • Reads one argument from the Linux command line:
    • if the argument is `0` the script calls `geomPosMean(mydata)` and prints the output of the function thus: "The geometric mean of positive values in the data is ...";
    • if the argument is `1` the script calls `negMean(mydata)` and prints the output of the function thus: "The mean of negative values in the data is ...";
    • if the argument is `2` the script calls `harmonicMean(mydata)` and prints the output of the function thus: "The harmonic mean of non-zero values in the data is ...";
    • if neither of these arguments is given, the script should output: "Error, incorrect command line argument."

3) Write a shell (bash) script (not an Python script), called `evalStats.sh`, which calls "selectStat.py" three times, once with an argument of `0`, once with the argument `1` and once with the argument `2`.


Submit your `evalStats.sh`, `selectStat.py`, `myFuncs.py` and the output of "git log" from your assignment repository.

To capture the output of 'git log' use redirection, git log > git.log, and hand in the "git.log" file.

Assignments will be graded on a 10 point basis.

Due date is March 24th, 2022 at midnight, with 0.5 point penalty per day for late submission until the cut-off date of March 31st, 2022 at 11:00am.

Contact site support
You are currently using guest access (Log in)
Data retention summary


All content on this website is made available under the Creative Commons Attribution 4.0 International licence, with the exception of all videos which are released under the Creative Commons Attribution-NoDerivatives 4.0 International licence.
Powered by Moodle