Homework 1: Getting Started

Subject: PSU/CS CGI Programming


CS161 Introduction to Programming and Problem Solving

Winter 2013

Due January 15, 2013


Exercise 1 is intended to introduce you to the programming environments you may encounter in developing Python code. It will require that you set up a Python environment on your own machine (if you have one) as well as remotely accessing a Linux host at the shell level.


Step 1. Install the IDLE environment and Python on your home machine, laptop, etc. If you don’t own your own computer, use the PCs in the CS Windows Lab in FAB 88 for the next part of the assignment.



Step 2. Write a Python program and save it (don’t just use the Interactive Mode) under the name hw1_LastName-FirstName-PC.py or hw1_LastName-FirstName-Mac.py. When run, the program should display your name, e-mail address, the type of environment you are using and major in the following format (but with your own information):


Warren Harrison


Windows 7

Computer Science


The display should be left justified as shown above. Nothing else, just these four lines, in this order.



Step 3.  If you are using a Windows machine, install PuTTY. If you are using the PCs in the CS Windows Lab, PuTTY is already installed. Using PuTTY, login to linux.cecs.pdx.edu



You will be prompted for your CS username and password.


If you are using a Mac, you can open a terminal (Go/Utilities/Terminal) window. In order to login, type


ssh yourLogin@linux.cecs.pdx.edu


You will be prompted for your password.



Step 4. Use the code editor nano to create pretty much the same program you wrote in Step 2 except rather than displaying “Windows” or “Mac” it will display “Linux.” Type:


nano hw1_LastName-FirstName-Linux.py


This will save the code under the name hw1_LastName-FirstName-Linux.py. Run it to make sure that it works:


python3 hw1_LastName-FirstName-Linux.py



Step 5. E-mail the file you just created to yourself using the following command:


mail e-mailAddress < hw1_LastName-FirstName-Linux.py


Make sure you logoff when you are done:




Save the e-mail you mailed yourself as hw1_LastName-FirstName-Linux.py.



Step 6. Submit the two program files, hw1_LastName-FirstName-Linux.py and hw1_LastName-FirstName-PC.py using the CS161 moodle,