<jupyter_start><jupyter_text>Ex1 A deck as a sequence of playing cards<jupyter_code>import collections
Card = collections.namedtuple('Card',['rank','suit'])
class FrenchDeck:
    ranks = [str(n) for n in range(2,11)] + list('JQKA')
    suits = 'spades diamonds clubs hearts'.split()
    
    def __init__(self):
        self._cards = [Card(rank,suit) for suit in self.suits
                      for rank in self.ranks]
    
    def __len__(self):
        return len(self._cards)
    
    def __getitem__(self,position):
        return self._cards[position]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11754684838160136, 'fraction_numerical': 0.0068143100511073255, 'mean_word_length': 3.2302158273381294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '118092', 'license': 'MIT', 'n_tokens_mistral': 191, 'n_tokens_neox': 186, 'n_words': 46, 'path': 'fluent python 2nd/ch01.ipynb', 'repo_name': 'meininghang/Personal-Learning', 'size': '587'}