[Tutor] Python Tutorial rel 2.2.2 - need debug for 4.4.
Code example
Bob Gailer
ramrom@earthling.net
Sat Jan 18 17:33:01 2003
--=======69725E0C=======
Content-Type: text/plain; x-avg-checked=avg-ok-B74577E; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit
Change the indentation of the last 2 lines:
for n in range( 2, 10 ):
for x in range( 2, n ):
if n % x == 0:
print n, 'equals', x, '*', n/x
break
else:
print n, 'is a prime number.'
At 10:09 PM 1/18/2003 +0000, ahimsa wrote:
>Could someone help me to understand - and even debug - the following.
>for n in range( 2, 10 ):
> for x in range( 2, n ):
> if n % x == 0:
> print n, 'equals', x, '*', n/x
> break
> else:
> print n, 'is a prime number.'
>
>3 is a prime number.
>4 equals 2 * 2
>5 is a prime number.
>5 is a prime number.
>5 is a prime number.
>6 equals 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 equals 2 * 4
>9 is a prime number.
>9 equals 3 * 3
Bob Gailer
mailto:ramrom@earthling.net
303 442 2625
--=======69725E0C=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-B74577E
Content-Disposition: inline
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.438 / Virus Database: 246 - Release Date: 1/7/2003
--=======69725E0C=======--