remove to use.
#! /usr/bin/env python
import sys
try: 
    import cgitb # NOTE Indentation
    cgitb.enable()
except ImportError:
    sys.stderr = sys.stdout

# NOTE, Python is really strict about indenting all
# the function definitions, otherwise it will stop.
#
def cgiprint(inline=''):
    sys.stdout.write(inline)
    sys.stdout.write('\r\n')
    sys.stdout.flush()           

contentheader = 'Content-Type: text/html'
def fibo1(n):
    """
    slightly modififed from Python tutorial -- non-recursive
    so you can get fibo1(10000) without hitting upper limits
    on recursive depth
    """
    i, a, b = 0, 0, 1L # Note the  L makes it a long integer.
    while i < n:  
        a, b = b, a+b
        i = i + 1  # or i += 1 in Python 2.0

    return a


title = 'Fibonacci Python Example'
thepage = '''
%s

%s

'''
h1 = '

%s

' if __name__ == '__main__': cgiprint(contentheader) # content header cgiprint() # finish headers with blank line headline = h1 % 'Fibonacci Python Example for series of all numbers < 10000 ' i = 25 Result = fibo1(i) # call it print thepage % (title, headline) print "The " + str(i) + "th element of the fibonacci series is: " + str(Result) + ". " print " Please compare this with the Perl function I wrote. " print " They should match! " print " The way this function is written, the " + str(i) + "th" print "element will match the " + str(i + 1) + "th" print "element for the Perl Function. "
Remove to use.