title: Convert string object created from a class to list
body: <p>In the task, I am trying to create an object of a deck of cards. The output is something like ['A of Hearts', 'A of Diamonds', 'A of Clubs', ...] and what I want is to convert the output to a list and get the length of the list. </p>
  
  <p>After I created an instance from the class, I tried to get the type of the output, and it returns <code>&lt;class '__main__.Card'&gt;</code>. </p>
  
  <p>I tried to convert the output, which should be a string, into a list by: </p>
  
  <ol>
  <li><p>Split the output string </p></li>
  <li><p>directly use list() function </p></li>
  </ol>
  
  <pre><code>class Card:
      def __init__(self):
          self.suit = ["Hearts","Diamonds","Clubs","Spades"]
          self.value = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"]
          self.cards = [] 
  
          for x in self.value:
              y = x + " of"
              for z in self.suit :
                  aa = y + " " + z
                  self.cards.append(aa)
  
      def __repr__(self): 
          return str(self.cards) 
  
  cards1 = Card()
  </code></pre>
  
  <p>When I use the first function, it returns error 
  'Card' object has no attribute 'split'</p>
  
  <p>When I use the second function, it returns error 'Card' object is not iterable</p>
  
  <p>In this case what should I do?
  Many thanks</p>