(C) Marateck 2009

Here are the instructions for downloading the Python interpreter and the Idle IDE (Integrated Development Environment).

the IDE will enable you to compile, debug and run your programs by chosing menu options. For instance, if you make a compilation error, Python displays the error messages.

DOWNLOADING THE Python BUNDLE for a PC

  1. Go to the Python download URL:
    http://www.python.org/download/releases/3.1/
  2. Click Download
  3. Under "also look at the detailed Python 3.1.2 page" click the Python 3.1 Windows Installer link.
  4. A window labeled Opening python-3.1.2.msi. Click Save File
  5. After the download is complete, a dialog box will open asking "Would you like to save this file?", click Save file
  6. An icon labelled "python-3.1" for release 3.1 will appear on the screen. (Perhaps a more recent release will appear.)
  7. When you click the icon, the computer will ask "Do you want to run this file?", Click the run button.
  8. In the setup box, the option "install for all users" will have a circle with a period in it. Click the next button.
  9. A box asking you to select destination directory with the proposed directory Python30. Click the next button.
  10. In the next dialog box (Customize Python 3.1), click the next button.
  11. Finally, click finish.
To get the IDE icon on the screen, go to Start/All Programs/python 3.0. A small window will appear to the right with IDLE(PythonGUI). Drag IDLE(PythonGUI) to the screen (it's called the desktop).

DOWNLOADING THE Python BUNDLE for a Mac Using the Official Site

  1. Go to the Python for a MAC download URL:
    http://www.python.org/download/mac/ If this site is not available, go to instructions below.
  2. Click Download on the left and you will be taken to a window with Download Python
  3. Under "also look at the detailed Python 3.1.2 page" click the Python 3.1.2 Mac OS X Installer Disk Image (for Mac OS X 10.3 through 10.6)
  4. A window opens indicating that you want to open python-3.1.1.dmg,If the Save fileacircle does not have a dot, click it. Then click OK.
  5. The download window will open. Click the icon.
  6. In a short while, Install Succeded will appear. Ckick the close button.
  7. On the desktop or in the Applications folder in the Finder, click Python 3.1 and then the Idle icon.


DOWNLOADING THE Python BUNDLE for a Mac Using another Site

  1. Go to the Python for a MAC download URL:
    http://download.cnet.com/Python/3000-2247_4-6565.html?tag=mncol
  2. Under Python 3.1 for Mac, hit the green button to the left of Download Now.
  3. In the Downloads window, you will see Python 3.1 being downloaded.
  4. After the download is completed, a Python 3.1 window will appear, double click the Python.mpkg icon.
  5. Continue clicking in the affirmative (either the Continue or the Agree button).
  6. At some point, the computer will direct you to Select aDestination . Click the Macintosh HD icon and then the Continue button.
  7. In the Install Python window click Install.
  8. You may then be asked for your password. If so, type it and hit OK.
  9. Then, hopefully you will see Install Succeeded on the screen. Ckick the close button.
  10. On the desktop or in the Applications folder in the Finder, click Python 3.1 and then the Idle icon.

Using Python as a Calulator

  1. Double click the IDLE(Python GUI) icon and a screen will appear with the >>> prompt. This is called the Python shell. You can type any expression you want, e.g., 3*4 - 5, hit Enter, and the result, 7, will be displayed. The operator for taking the mod is //.
  2. You may use branching and loop statements too, e.g., Then hit Enter.

Using Python to Save Programs

In order to save a program, you must write a method
:

  1. In the shell, on the File menu, select New window and a new window will appear.
  2. Start by writing def followed by the name of your method, let's call it fibo. The method name must be followed by a "():". the ":" will automatically indent the next set of statements.
  3. When you are finished writing your statements, go to the File menu and select Save as and save it as, let's say Prog1.py. The .py extension stands for Python. Python will inform you if you have made an error.
  4. Then on the Run menu, select Run module. You are then transferred to the shell.
  5. In the shell, type fibo() and your program will be executed.

Running a Program Simply by Selecting Run Module

To run a program simply by selecting Run Module:

  1. Add another method called main() to your original method and have main() call fibo().
  2. End you program by writing "main()" at the end of your program,
Your program should look something like
:
def fibo():
    a = 2
    b = 3
    print(a*b)

def main():
    fibo()

main()

After you select Run Module, your program should run in the shell without you doing anything else.


Samuel Marateck
Aug 31 EDT 2001, revised June 15 2009