title: How could I add restrictions or rules to a list in Python?
body: <p>I'm doing a solitaire program, and it's meant to run in the Python shell instead of a GUI. But I'm not quite so sure how to program the cards so that a <code>Red Suit</code> can be appended onto a <code>Black Suit</code> and vice versa. Also, the number of the card that is to be appended has to be lower than card before it. </p>
  
  <p>I suppose the program used to add restrictions to the row stacks could be similar to the program used to add restrictions to the suit stacks. If it's different, could you also give me some help on this? Because I've nearly finished the project, but I've just got to add rules. </p>
  
  <p>I've tried to figure out how I could do it, but it seems quite complicated.</p>
  
  <pre><code>def check(card1,card2):
      valid = True
      cardSuit = Card1[1]
      cardVal  = card1[0]
  
      if cardSuit2 == cardSuit[1]:
          valid = False
  
      elif value(CardVal1) &gt; value(cardVal2):
          valid = False
  
      elif valid == False:
         # print Error Message
  
      return valid
  
  # Function to call above function
  def call():
      ok = check(card1,card2)
      if ok = True:
          # proceed with code
  
  def value(str):
                if val is (2,3,4,5,6,7,8,9,10):
                denon = int(val)
                elif val = 'J':
                denon = 11
                elif val = 'Q':
                denon = 12
                elif val = 'K':
                denon = 13
  
      return denon
  </code></pre>
  
  <p>Thanks.</p>