[ edit ]

def is_prime_number( x ):
    last = int( x ** 0.5 )
    for i in range( 2, last + 1 ):
        if is_divisor( i, x ):
            return( False )
    return( True )

   1 def is_divisor( d, x ):
   2     return( x % d == 0 )

   1 def is_divisor( d, x ):
   2     if x % d == 0:
   3         return( True )
   4     else:
   5         return( False )

   1 def is_prime_number( x ):
   2     for i in range( 2, int( x ** 0.5 + 1 ) ):
   3         if x % d == 0 :
   4             return( False )
   5     return( True )

SoftEng: Python/Prog/Practice/Basic/02/BP_008a/Digest (last edited 2019-10-16 14:40:01 by TadashiIijima)