The computer workstations in our lab can run both Windows and Linux operating systems. We will use the Linux operating system in this course.
Note: Outside of lab, you may access your Linux account from any computer connected to the Internet, provided you have the right access software, e.g., a secure shell client program. Some work for this course you can do from any computer, but most work you will have to do directly on the Linux machines.
After the lab, you should know how to
If you can do all those things, you are all set for the course!
For this part of the lab, work through this document and do the exercises. Hand in the worksheet before you leave lab.
example.css
, example.html
, and
example.jpg
files from
/home/courses/cs111/handouts/lab0
into your public_html directory.
(Recall: what is the special name for the current directory?)
http://www.cs.wlu.edu/~yourusername/example.html
You
should see the example web page. If you get an error message in the
browser window, ask for help.
http://www.cs.wlu.edu/~yourusername/
example.html
into a file named
index.html
. Now, point your browser to the location:
http://www.cs.wlu.edu/~yourusername/
(We can talk about what's going on here more later in the course, but for now, just realize that index.html hides the contents of your web directory.)
jedit index.html &
The "&" (called the "ampersand") is a special command to let the terminal know that you want the program to open in a new window and let you keep using the terminal window too. I will also refer to the ampersand as saying that you want the command to "run in the background".
jEdit is a "text editor", i.e., a program that helps you create files. jEdit looks similar to a Word Processor. Look through some of the menus and you'll notice a lot of functionality that you'd see in a typical Word Processor, such as save, open, copy, and paste.
Note that the page has several links to other online documents in it. The HTML Help link is useful if you want to develop more web pages after this brief introduction.
Note the pattern of the links in the HTML file. How would you create a link to CNN? (You will perform similar activities throughout the course. You'll look at example code that does something similar to what you want to do, copy the code, and modify the code to do what you want.)
img
) tag in your web page to display this image.
Note that you didn't need any fancy software to be able to create a nice web page. I create my web pages for the course in a similar manner.
labs/lab0
.)
In general, on our system, you have two options for writing Python programs:
You might want to try them both to see which way you prefer.
Either way, you'll use IDLE to demonstrate your program working.
For this part of the exercise, use IDLE.
idle &
Recall: what does the & allow you to do?
You can use the shell to tryout expressions before putting them into a script. To get the shell in the terminal, simply type "python". In IDLE, the main window is the Python shell.
hello.py
, which you copied
earlier. What should the code do? Execute the script by
hitting Control-F5 to verify your expectations.
second.py.
- Save the output from the shell in a file called
lab0.practice.out
. Make sure that this file is saved in the
appropriate directory.
Your programs will be graded on both correctness and style.
Note that the convention is that the names of Python scripts end in ".py".
info.py
that prints out
information about yourself. The info printed should list your name,
favorite sports team (could be professional, college, or other), favorite
color, and favorite dwarf (Sleepy, Sneezy, Happy, Grumpy, Dopey, Bashful,
or Doc). Don't forget to document your program appropriately!
The output should looks something like:
Example Output:
Name: Sara Sprenkle Favorite team: Duke Favorite color: purple Favorite dwarf: Doc |
After you are sure that your program works and you have saved your
program, start or restart IDLE. (This is an ugly, inefficent way to do
things if you were using IDLE to develop your program, but you want a
"clean" shell to demonstrate that your program is working correctly.)
Execute your program to demonstrate that your program works. Save the
output from the shell in a file called info.out
.
Example Output:
Enter the radius: 3 The area is 28.27431 square units. |
After you are sure that your program works and you have saved your
program, start (or restart) IDLE. Execute your program several times to
demonstrate that your program works. Save the output from the shell in a
file called trianglearea.out
.
/home/courses/cs111/handouts/printLab.sh <labdirpath>
lab0
directory, it's easiest to "go up a
level" to the parent directory and use The script printLab.sh
creates a condensed version of your lab in a postscript file called
lab0.ps
. To save paper, the script puts two pages on a piece
of paper. The script also highlights the Python code appropriately.
lpr
-P<printername> lab0.ps
cslab
when you're in P405 or advlab
if you're in P413.
lpr
means to print the file. The option 'P' says
which printer to use (one of the CS lab printers), and the argument says which file
to print--in this case lab0.ps
.
turnin
directory.
(Review the UNIX handout if you don't remember how to
do that.)
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!