[docs] Algorithm error
Georg Brandl
georg at python.org
Sun Oct 17 13:22:34 CEST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 28.09.2010 17:53, schrieb eric.takada at embraer.com.br:
>
> Hi,
>
> in section */"4.4 break and continue Statements, and else Clauses on Loops"
> /*there is an error in the example code. The "range" in "for x in range(2, n): "
> shall be changed to "range(1,n):" in order to produce the output described in
> the example, since "range[2,2]" produces a null result.
>
> Regards,
>
> Eric Takada
Hi Eric,
please retry running the example; it is correct as written. Note that the
"else" clause belongs to the for loop, and not the if condition, and therefore
has different semantics (for example, it is executed in the case that the loop
does not run at all.)
regards,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
iEYEARECAAYFAky63HoACgkQN9GcIYhpnLDG5QCeIGLEeWz0Zbt0l4hSAnGYEF1r
MvEAoIm5wG5GLw0qcHqDnr6jl3ZB3XFc
=o1f/
-----END PGP SIGNATURE-----
More information about the docs
mailing list