Tutorial update for 3.0 by Paul Dubois.

I had to fix a few markup issues in controlflow.rst and modules.rst.

There's a unicode issue on line 448 in introduction.rst that someone else needs to fix.
This commit is contained in:
Guido van Rossum 2007-08-31 03:25:11 +00:00
parent 8b2af27dae
commit 0616b792ba
12 changed files with 379 additions and 353 deletions

View file

@ -67,7 +67,7 @@ instance the following output results from running ``python demo.py one two
three`` at the command line::
>>> import sys
>>> print sys.argv
>>> print(sys.argv)
['demo.py', 'one', 'two', 'three']
The :mod:`getopt` module processes *sys.argv* using the conventions of the Unix
@ -138,6 +138,8 @@ The :mod:`random` module provides tools for making random selections::
>>> random.randrange(6) # random integer chosen from range(6)
4
The SciPy project <http://scipy.org> has many other modules for numerical
computations.
.. _tut-internet-access:
@ -151,7 +153,7 @@ and :mod:`smtplib` for sending mail::
>>> import urllib2
>>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'):
... if 'EST' in line or 'EDT' in line: # look for Eastern Time
... print line
... print(line)
<BR>Nov. 25, 09:43:32 PM EST
@ -259,7 +261,7 @@ documentation::
def average(values):
"""Computes the arithmetic mean of a list of numbers.
>>> print average([20, 30, 70])
>>> print(average([20, 30, 70]))
40.0
"""
return sum(values, 0.0) / len(values)