Program 1 - Installing and Using Python

In this assignment you will write your first Python program. Begin by working through Chapter 1 of the book. Install Python 3.3.0 and type along with the examples.

Here is another example program.

celsius = 32
fahrenheit = (9.0/5.0) * celsius + 32
print(celsius," Celsius is ",fahrenheit," Fahrenheit.")


It prints out:

32 Celsius is 89.599999999999994 Fahrenheit.

You should write a similar program that converts a temperature given in Fahrenheit to Celsius. That is, it should print out something like:

89 Fahrenheit is 31.666666666666668 Celsius.

Your program should NOT consist of a single print statement; it should have three lines, similar to the ones in the given program, and it should correctly convert a temperature, given in Farhernheit, to Celsius.

Where to do the assignment

You can do this assignment on your own computer, or in our lab, 75 Hutchinson. If you do the assignment in one of the labs, note that to get to IDLE you choose "Class software", then "Python 3.3", and then "IDLE".

To do the assignment on your own computer, you will need to install Python. We strongly recommend you install Python, and we strongly recommend that you do it this week. If you have a laptop, you could bring it to lab hours for help with the installation.

Either way, we suggest you begin by making a new folder on your Desktop, called "ECS 10", where you can keep your work. To do this, put the mouse on an empty spot on the Desktop and right click, select "New" and then "Folder". When the folder appears, its name should be highlighted; type "ECS 10" to rename it.

Getting started

Start up IDLE. You get an "interacitve" window, in which each command is executed immediately. Open a "script" window, in which you type a whole program and then run it, by selecting "File", and then "New Window".

You type your program into the script window. When you try to run it, you will be asked to save it. Save it to your new folder on the Desktop. The name of your program should end in ".py", for instance, "prog1.py". In Windows, it will show up, in the folder, with the Python logo. The program should then run immediately, producing the output in the interpreter window, not in the script window.

Submitting the Assignment

We will be using SmartSite to turn in assignments. Go to SmartSite, go to ECS 010, and go to Assignments. Submit the file containing your program as an attachment.

Do NOT cut-and-paste your program into a text window. Do NOT hand in a screenshot of your program's output. Do NOT hand in a text file containing the words "89 Fahrenheit is... We want the file containing your Python program, for example "prog1.py". When grading the program, we will run it, in IDLE, to check what it does.

Saving your work

If you are working on your own computer, you can just leave the ECS 10 folder on your Desktop for the rest of the quarter. If you are working in the lab, you will need to take the folder with you on your flash-drive or save it to your workspace on SmartSite. To save it on flash-drive, plug the flash-drive into the computer (the staff in the computer classrooms can help you figure out how), open the flash-drive, and copy the whole ECS 10 folder onto it by moving the folder from the Desktop onto the flash-drive. To copy the file to your SmartSite workspace, go to Workspace, select Resources, and then use the Add button next to "My Workspace".