CS.112 Lab #1 1

1.  Download and install Python 3.3.2 onto your computer. You will need it to complete many of the labs in this course. Click on this link and scroll down the page to the Download section. If you are using a Windows computer you will want to download the Windows x86 MSI Installer version. There is also a Mac version available.

2.  Start the IDLE Environment for Python. If the Edit window for entering code does not come up, go to Options, Configure IDLE, click on the General tab, and under Startup Preferences select Open Edit Window. Close and reopen the Environment. Prior to entering code, save your file by clicking on File and then Save. Select your desired location and save this file as Lab1.

3.  Code should always start with documentation. Document the first few lines of your program to include your name, the date, and a brief description of what the program does. Each line that you want to comment out must begin with a # sign. For example:

# Cathi Brewer

# September 2, 2013

# This program displays Hello World.

Notice how the comments changed to red text. This is the IDLE’s way of letting you know that it recognizes these lines are comments and shouldn’t be read by the compiler.

4.  After the documentation, enter the following line of code into your program.

print ("Hello World")

Notice how the print word changed to purple text. This is the IDLE’s way of letting you know that it recognizes that as one of Python’s keywords. The text inside the double quotes should change to green text. As you code in Python remember to pay attention to these colors because they can help prevent you from making common syntax errors.

5.  On the menu, select Run and then Run Module or you can use the F5 keyboard shortcut. If you typed everything correctly the Python Shell window should display with your program output. If you didn’t type it exactly like above you will get a syntax error, you must fix it before you are able to run your program. Click OK and review the highlighted syntax error to fix it and then try to Run it again. Keep repeating this process until you get it correct.

6.  Your screen output should look like the following:

7.  Close the Shell window and close the Edit window. Be sure to save your program if needed. Submit your completed lab1.py file to the portal for grading.

Congratulations! You just coded your first program! You are on your way to bossing that CPU around!