Write a command-line program that does addition and subtraction:
\n", "\n", "$ python arith.py add 1 2
\n",
"\n",
"3
\n",
"\n",
"$ python arith.py subtract 3 4
\n",
"\n",
"-1
\n",
"\n",
"Using the glob
module introduced earlier, write a simple version of ls
that shows files in the current directory with a particular suffix. A call to this script should look like this:
$ python my_ls.py py
\n",
"\n",
"left.py\n",
"right.py\n",
"zero.py
\n",
"\n",
"Rewrite readings.py
so that it uses -n
, -m
, and -x
instead of --min
, --mean
, and --max
respectively. Is the code easier to read? Is the program easier to understand?
Separately, modify readings.py
so that if no parameters are given (i.e., no action is specified and no filenames are given), it prints a message explaining how it should be used.
Separately, modify readings.py
so that if no action is given it displays the means of the data.
Write a program called check.py
that takes the names of one or more inflammation data files as arguments and checks that all the files have the same number of rows and columns. What is the best way to test your program?
Write a program called line-count.py
that works like the Unix wc
command: