Computer Science 111b - Lab #2

September 14, 2006

The main purpose of today's lab is to have you write your first Python program "from scratch".

Choose a partner from this lab. If you are from off campus or have a good reason to work without a partner, please identify yourself. We'll spend a few minutes working out partners at the beginning of lab.

One of you or your partner should Login to the network using your Novell Netware account, and use the secure shell client (ssh) to log in to Beowulf.csc.smith.edu using your class account. You will be sharing the typing with your partner. When the program is done we'll transfer it to your partner.

How to share: Sit so you are both in front of the monitor. Don't move your chairs. Rather, slide the keyboard and mouse to the right or left to change who is typing. Hopefully you will naturally exchange typists. But occasionally I will just announce that it is time to switch.

Next use the secure shell client (ssh) and one of you will to log in to Beowulf.csc.smith.edu.

The program you will write today is the beginning of an automated teller machine program.

Use emacs to write your own version of the ATM program. Put it in a file called lab2.py (i.e. type emacs lab2.py. Here is what your program should do:

Note 1: the change.py program is also on on page 52 of the text. is similar to

Note 2: You can write different things, format them differently, etc. However, the input should be in the same order and no extra input should be added!!

Start the Python Interpreter and import the program and run it. Does the amount of money print correctly on the screen? If not, correct your program and run it again.

Mini-Tutorial on Linux Command line

Before you log off from Beowulf, you should transfer the program to the partner's account.

We can use sftp to do that. At the beowulf prompt, type:
sftp 111a-XX@beowulf.csc.smith.edu
where XX are the two letters of the account for the partner who does not have a copy of the file yet. Beowulf will prompt you for the password for account 111a-XX.
111a-XX@beowulf.csc's password:
Note! When you type your password, nothing appears on the screen. You will receive the sftp prompt and you will put the file into the other account:
sftp> put lab2.py
The sftp response looks something like this:
lab2.py                       100%  266   146.1KB/s   00:00 
To exit from sftp, just type
sftp> quit
Now, log in to the account you just put the file into and type
ls
to double check that the file lab2.py is in the other account.

You are now ready to do Homework #2 with your partner.

Whenever you are finished, always Log off of Beowulf and the Network server.