Kent Johnson wrote:
> A better way to check for divisibility is to use the modulo operator % 
> which gives the remainder when one number is divided by another. 
Only when the left argument is positive does it give the remainder. The 
manual is in error when it says remainder, but the algorithm it gives is 
correct.
> If a % 
> b == 0 then b is a factor of a.
>
> Kent
>
>   
>> On 12/5/06, *Kent Johnson * <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
>> wrote:
>>
>>     Eli Zabielski wrote:
>>      > How can I check if a variable is an integer?
>>
>>     Luke and John have answered your question, but we should also ask, why
>>     do you want to do that? Explicit type testing is a code smell, perhaps
>>     there is a better way to do what you want.
>>
>>     Kent
>>
>>
>>
>>
>> -- 
>> Eli Zabielski
>>     
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   


-- 
Bob Gailer
510-978-4454

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to