[issue2201] Documentation Section 4.4

Jarod report at bugs.python.org
Thu Feb 28 17:42:54 CET 2008


New submission from Jarod:

Section 4.4 of the tutorial gives example code: 

>>> for n in range(2, 10):
...     for x in range(2, n):
...         if n % x == 0:
...             print n, 'equals', x, '*', n/x
...             break
...     else:
...         # loop fell through without finding a factor
...         print n, 'is a prime number'
... 
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3

When one is to enter the code (print n, 'equals' x, '*' n/x) you are
given syntax error:   File "<stdin>", line 4
    print n, 'equals' x, '*' n/x
                      ^
SyntaxError: invalid syntax

----------
components: Documentation
messages: 63096
nosy: str8lazy
severity: normal
status: open
title: Documentation Section 4.4
type: compile error
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2201>
__________________________________


More information about the Python-bugs-list mailing list