[Tutor] Else Clause In A Loop
"Simón A. Ruiz"
sruiz at canterburyschool.org
Wed May 14 16:11:42 CEST 2008
kinuthia muchane wrote:
> On Tue, 2008-05-13 at 11:09 -0400, "Simón A. Ruiz" wrote:
>> When i is 3, then we'll only check (2 % 3 == 0) which is False, so the
>> loop ends unbroken and runs the else clause letting us know that 3 is
>> indeed a prime number.
>
> Shouldn't we be checking for (3%2 == 0) instead of (2%3 == 0)?
Absolutely right. My mistake.
>> Does this help at all?
>
> It was crystal clear! Thanks Simon (I didn't know how to put the accent
> mark over the 'o', though), the confusion is gone. ;)
Awesome. Glad I could be of help. :-D
Simón
More information about the Tutor
mailing list