After the lab, you should be proficient at
wc
command in LinuxYou will want to copy the files from your lab10 directory so that you can extend your Music Management program.
wc
Commandwc ../lab10/*.py
wc
stands for "Word Count". We called the "word
count" command on all the *.py files (i.e., the Python scripts, not
other files or directories) in your lab10 directory. The first column
of output is the number of lines, the second is the number of words,
and the third is the number of characters in each file. The total for
all the files is listed in the last line of output.
wc
command so that you only see the number of
lines, using the command-line argument "-l", i.e.,
wc -l ../lab10/*.py
>
operator, i.e.,
wc -l ../lab10/*.py > mywc.txt
more
or cat or opening it in a text editor,
such as jEdit. We will come back to this file later.
You may want to get one of the new albums files
added by your peers to help with your testing. They've been added to
the handouts/lab10/albums
directory too.
Example Run:
Select one of the following options: (V)iew the library (I)mport songs into the library (S)ort the library (F)ind songs by title E(X)port the library to a file (Q)uit the program Which option do you want? f What is the title of the song you want to find? misunderstood 2 songs match that title: Misunderstood Better Than Ezra Closer 00:03:47 Misunderstood Better Than Ezra Greatist Hits 00:03:45 Select one of the following options: (V)iew the library (I)mport songs into the library (S)ort the library (F)ind songs by title E(X)port the library to a file (Q)uit the program Which option do you want? f What is the title of the song you want to find? Change your mind 2 songs match that title: Change Your Mind Sister Hazel Fortress 00:04:22 Change Your Mind The Killers Hot Fuss 00:03:10
wc
command again. This time, view the size of
the .py files in your lab11 directory. Add the output from this
command to your mywc.txt
file using
the >>
operator. An example of
running wc
from your lab11 directory is
wc -l *.py >> mywc.txt
Now, when you view your mywc.txt file, you should be able to compute how many more lines of code you added to your files for this part of the project. Document this difference in comments in your driver program.
After you've developed a correct solution to each program, restart IDLE or close and reopen the IDLE "shell" by running the program again (using F5), demonstrate that the program works using several good test cases, and save the output to a file named lab11.x.out, where x is the problem number.
[[1,2,3], [4,5, 6], [7,8,9]]
1 2 3 4 5 6 7 8 9
Test on the 2D list you created in the previous program. Print the matrix before and after the tranposition.
The transposed result for that 2D list should be
1 4 7 2 5 8 3 6 9
turnin
directory.
(Review the UNIX handout if you don't
remember how to do that.)
printLab.sh
command to create a file to
print out. You should probably print from the labs
directory. You may get a warning about the directory containing
subdirectories. As long as you don't get an
enscript
error about unknown special escape, you
should be okay.
gv
command, such as gv lab11.ps
Print the file using the lpr
command
introduced in the first lab.
Labs are due at the beginning of Friday's class. You should hand
in the printed copy at the beginning of class, and the electronic
version should be in the turnin
directory before 2:25
p.m. on Friday.
Ask well before the deadline if you need help turning in your assignment!