Revision 22 as of 2009-02-08 02:10:06

Clear message

Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.

IDLE 2.6 >>> print 'hello world' hello world >>> name = raw_input('What is your name?\n') # \n is a newline What is your name? print 'Hi', name >>> my_list = ['john', 'pat', 'gary', 'michael'] for i, name in enumerate(my_list):

>>> def greet(name):

greet('Jack') greet('Jill') greet('Bob') import re for test_string in ['555-1212', 'ILL-EGAL']:

prices = {'apple': 0.40, 'banana': 0.50} my_purchase = {

grocery_bill = sum(prices[fruit] * my_purchase[fruit]

print 'I owe the grocer $%.2f' % grocery_bill #!/usr/bin/env python # This program adds up integers in the command line import sys try:

except ValueError:

# indent your Python code to put into an email import glob # glob supports Unix style pathname extensions python_files = glob.glob('*.py') for fn in sorted(python_files):


', fn

Unable to edit the page? See the FrontPage for instructions.