Bugs item #1210832, was opened at 2005-05-29 08:28 Message generated for change (Comment added) made by josiahcarlson You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1210832&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Gene (godhand) Assigned to: Nobody/Anonymous (nobody) Summary: An error in Python Tutorial Initial Comment: In section 4.4, the program should be written as follow to get the correct result: -------------------------------------------------------------- for n in range(2, 10): for x in range(2, n): if n % x == 0: print n, 'equals', x, '*', n/x break if x == n-1: print n, 'is a prime number' -------------------------------------------------------------- besides, the line "2 is a prime number" should not appear in the result output. ---------------------------------------------------------------------- Comment By: Josiah Carlson (josiahcarlson) Date: 2005-05-30 23:22 Message: Logged In: YES user_id=341410 The indentation on your proposed code addition was lost during your post, re-post so that it is understandable. Further, from mathworld.com: "A prime number (or prime integer, often simply called a ''prime'' for short) is a positive integer p > 1 that has no positive integer divisors other than 1 and p itself. (More concisely, a prime number p is a positive integer having exactly one positive divisor other than 1.)" That is to say, 2 is prime, so should appear in the result output, and it seems to me that the code provided in tutorial section 4.4 is correct. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1210832&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com