(C) Marateck 2012

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.2/ .
  2. At the bottom of the page under Download click either:
  3. After the download is complete, a dialog box will open asking "Would you like to save this file?", click Save file.
  4. In the setup box, click the next button until Python is installed.
  5. Finally, click finish. To get the IDE icon on the screen, go to Start/All Programs/Python 3.2. 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

Determine what version of Python is pre-installed on your Mac
  1. Determine which operating system you have on your Mac. From the Apple menu (the one with the apple icon) select About this Mac. This will indicate the operating system. This is important. If you don't know the OS used on your computer, you may download the wrong version of Python for your computer and the compiler will not work.
  2. 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.
  3. Click Download on the left and you will be taken to a window with Download Python
  4. Under Download Python you will see "The current production versions are Python 2.7.2 and Python 3.2.2.". Click the the The Python 3.2.2 link.
  5. At the bottom of the page
  6. A window opens indicating that you want to open python-3.1.2.dmg,If the Save file circle does not have a dot, click it. Then click OK.
  7. The download window will open. Click the blue strip in the Downloads window.
  8. A window labelled Python 3.2.2 will open. Click the Python.mpkg icon.
  9. Continue clicking continue until the window with Agree appears. Click agree.
  10. Click the HD icon.
  11. Finally Install succeeded appears.
  12. Click close.
  13. On the desktop or in the Applications folder in the Finder, click Python 3.2 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.2 for Mac, hit the green button to the left of Download Now.
  3. In the Downloads window, you will see Python 3.2 being downloaded.
  4. After the download is completed, a Python 3.2 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.2 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 Jan 22 2012