Getting Started With Python Programming

Revision as of 03:42, 3 June 2010 by Joml88 (talk | contribs) (Created page with 'This guide takes you through the process of getting started with programming using the Python language. The sections flow from one to the next so it's recommended to read th…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This guide takes you through the process of getting started with programming using the Python language. The sections flow from one to the next so it's recommended to read through this document linearly.

Installing Python

1. Download the installer:

2. Run the installer. 3. Click next for every option in the setup wizard (i.e. use the defaults).

Using the Idle Command Line

The Python installation comes with an easy-to-use text editor called Idle. You should start by playing around with this. You should be able to find Idle wherever Python was installed. On Mac this should be in the Applications folder while on Windows it should be accessible from the Start menu in a folder named Python or something close to that.

When you first open Idle, you'll see the command line:

Idle1.png

The command line is very useful for quick math and short sequences of commands:

Idle2.png

Take some time to play around with the Python command line.

The Idle Text Editor and Your First Python Program

For most programming needs, you'll want to edit your program in a separate document and then run it. In the file menu click on New Window which should give you a blank document with the title "Untitled". To get acquainted with the text editor, let's write our first Python program! We'll write a program to solve the | first Euler Project problem which asks:

Find the sum of all the multiples of 3 or 5 below 1000.

Our basic strategy will be to add up all the multiples of 3 below 1000, then add to that the multiples of 5, and then subtract out the multiples of 15 since they will have been counted twice.

Invalid username
Login to AoPS