def AbelianGroup(*cyclic_orders):
 groups = []
 degree = 0
 order = 1
 for size in cyclic_orders:
  degree += size
  order *= size
  groups.append(CyclicGroup(size))
 G = DirectProduct(*groups)
 G._is_abelian = True
 G._degree = degree
 G._order = order
 return G

def AbelianGroup ( * cyclic_orders ) : groups = [ ] degree = 0 order = 1 for size in cyclic_orders : degree += size order *= size groups . append ( CyclicGroup ( size ) ) G = DirectProduct ( * groups ) G . _is_abelian = True G . _degree = degree G . _order = order return G
returns the direct product of cyclic groups with the given orders .