title: Is there a more efficient way to re-write multi if-else statement
body: <p>I want to ask is there a more efficient and proper way to re-write my following code (simply because there are a lot of if-else statements)</p>
  
  <p>the key_list in the following is a list of lists that each contains some DNA bases, e.g. key_list = [['-'],['A'],['A','T'],['C','G','T']] and '-' is used to present a special gap.</p>
  
  <p>I got an idea is to use a dictionary to build a mapping relationship between these statements, but not so sure about the correctness.</p>
  
  <pre><code>output = []
  for l in key_list:
      if len(l) == 1:
          output.append(l[0])
      elif len(l) == 2:
          if set(l) == set(['A', 'G']):
              output.append('R')
          elif set(l) == set(['C', 'T']):
              output.append('Y')
          elif set(l) == set(['A', 'C']):
              output.append('M')
          elif set(l) == set(['G', 'T']):
              output.append('K')
          elif set(l) == set(['G', 'C']):
              output.append('S')
          elif set(l) == set(['A', 'T']):
              output.append('W')
          else:
              print('Error!')
      elif len(l) == 3:
          if set(l) == set(['A', 'T', 'C']):
              output.append('H')
          elif set(l) == set(['G', 'T', 'C']):
              output.append('B')
          elif set(l) == set(['A', 'G', 'C']):
              output.append('V')
          elif set(l) == set(['A', 'T', 'G']):
              output.append('D')
          else:
              print('Error!')
      elif len(l) == 4:
          output.append('N')
      else:
          output.append('-')  # if there is only '-' in the column, also add it.
  </code></pre>