fork download
  1.  
  2. from collections import namedtuple
  3. from itertools import product
  4.  
  5. Carta = namedtuple('Carta', ['face', 'naipe'])
  6.  
  7. faces = {'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'}
  8. naipes = {'O', 'P', 'C', 'E'}
  9.  
  10. baralho = [Carta(face, naipe) for face, naipe in product(faces, naipes)]
  11.  
  12. print('Seu baralho possui', len(baralho), 'cartas')
Success #stdin #stdout 0.04s 9484KB
stdin
Standard input is empty
stdout
Seu baralho possui 52 cartas