Skip to content

Error in Python tutorial (http://docs.python.org/tut/node6.html) #46976

Closed

Description

@sandeepsabnani
BPO 2724
Nosy @birkenfeld, @amauryfa

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2008-04-30.09:02:24.765>
created_at = <Date 2008-04-30.08:47:40.174>
labels = ['invalid', 'docs']
title = 'Error in Python tutorial (http://docs.python.org/tut/node6.html)'
updated_at = <Date 2008-04-30.09:54:07.952>
user = 'https://bugs.python.org/sandeepsabnani'

bugs.python.org fields:

activity = <Date 2008-04-30.09:54:07.952>
actor = 'sandeepsabnani'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-04-30.09:02:24.765>
closer = 'amaury.forgeotdarc'
components = ['Documentation']
creation = <Date 2008-04-30.08:47:40.174>
creator = 'sandeepsabnani'
dependencies = []
files = []
hgrepos = []
issue_num = 2724
keywords = []
message_count = 3.0
messages = ['65996', '65997', '65998']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'amaury.forgeotdarc', 'sandeepsabnani']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue2724'
versions = ['Python 2.5']

Activity

  1. sandeepsabnani commented on Apr 30, 2008

    sandeepsabnanimannequin
    MannequinAuthor

    Section 4.4 on page http://docs.python.org/tut/node6.html has a for loop
    which uses the range function. However, the displayed output of that
    loop is not correct. I ran the same code and got the output as follows:

    3 is a prime number
    4 = 2 * 2
    5 is a prime number
    5 is a prime number
    5 is a prime number
    6 = 2 * 3
    7 is a prime number
    7 is a prime number
    7 is a prime number
    7 is a prime number
    7 is a prime number
    8 = 2 * 4
    9 is a prime number
    9 = 3 * 3

    Can this be corrected in the tutorial as it can be confusing for a
    python newbie!

    Thanks!

  2. amauryfa commented on Apr 30, 2008

    @amauryfa
    Contributor

    No, the example is correct, and gives the expected output.

    From the output you show, I suppose that you indented the "else:" clause
    incorrectly: it should align with the "for" loop, not the "if" statement.

    The "for...else.." construct is precisely the point of this paragraph.

  3. sandeepsabnani commented on Apr 30, 2008

    sandeepsabnanimannequin
    MannequinAuthor

    Oh yes! Thanks for clearing my doubt and apologies for the silly error.

  4. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dir

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions