Back to index

gcompris  8.2.2
Classes | Functions
gnumch Namespace Reference

Classes

class  Number
class  Square
class  Level
class  Levelset
class  PrimeLevelset
class  FactorLevelset
class  MultipleLevelset
class  ExpressionLevelset
class  EqualityLevelset
class  InequalityLevelset
class  Player
class  Muncher
class  Troggle
class  Gcompris_gnumch

Functions

def isPrime
def makeNumList
def getFactors

Function Documentation

def gnumch.getFactors (   n)

Definition at line 98 of file gnumch.py.

00098 
00099 def getFactors(n):
00100     f = []
00101     for i in range(1, n/2 + 1):
00102         if n%i == 0:
00103             f.append(i)
00104     f.append(n)
00105     return f

Here is the caller graph for this function:

def gnumch.isPrime (   n)

Definition at line 80 of file gnumch.py.

00080 
00081 def isPrime(n):
00082     if n == 1:
00083         return 0
00084     for i in range(2, int(math.sqrt(n) + 1) ):
00085         if (n % i) == 0:
00086             return 0
00087     return 1

Here is the caller graph for this function:

def gnumch.makeNumList (   nums)

Definition at line 88 of file gnumch.py.

00088 
00089 def makeNumList(nums):
00090     if len(nums) == 0:
00091         return ""
00092     fmt = '%d'
00093     if len(nums) >= 2:
00094         for i in range(1, len(nums)-1):
00095             fmt += _(', %d')
00096         fmt += _(' and %d')
00097     return fmt

Here is the caller graph for this function: