>>> from memory import Memory >>> m = Memory(4, 6) >>> m.omplir('ABCCAH', 0) >>> m.omplir('BADAEC', 1) >>> m.omplir('HDCFFE', 2) >>> m.omplir('FGAAGF', 3) >>> for f in range(4): # Dibuixem l'espai de joc (les cartes) ... for c in range(6): ... print(m[f,c], end='') ... print() ABCCAH BADAEC HDCFFE FGAAGF >>> it = m.parelles('B') >>> for pos in it: ... print(pos, end='-') (0, 1)-(1, 0)- >>> next(it, -1) # Comprovem que l'iterador s'ha exhaurit -1 >>> for pos in m.parelles('F'): ... print(pos, end='-') (2, 3)-(2, 4)-(3, 0)-(3, 5)- --fi-enunciat