title: combinations with python
body: <p>I am trying to generate combination of ID's </p>
  
  <p>Input: cid = SPARK</p>
  
  <p>oupout: list of all the comibnations as below, position of each element should be constant. I am a beginner in python any help here is much appreciated.</p>
  
  <blockquote>
  <pre><code>'S****'
  'S***K'
  'S**R*'
  'S**RK'
  'S*A**'
  'S*A*K'
  'S*AR*'
  'S*ARK'
  'SP***'
  'SP**K'
  'SP*R*'
  'SP*RK'
  'SPA**'
  'SPA*K'
  'SPAR*'
  'SPARK'
  </code></pre>
  </blockquote>
  
  <p>I tried below, I need a dynamic code:</p>
  
  <pre><code>cid = 'SPARK'
  
  # print(cid.replace(cid[1],'*'))
  # cu_len = lenth of cid [SPARK] here which is 5
  # com_stars = how many stars i.e '*' or '**'
  def cubiod_combo_gen(cu_len, com_stars, j_ite, i_ite):
      cubiodList = []
      crange = cu_len
      i = i_ite #2 #3
      j = j_ite #1
      # com_stars = ['*','**','***','****']
  
      while( i &lt;= crange):
      # print(j,i)
          if len(com_stars) == 1:
              x = len(com_stars)
              n_cid = cid.replace(cid[j:i],com_stars)
              i += x
              j += x
              cubiodList.append(n_cid)
          elif len(com_stars) == 2:
              x = len(com_stars)
              n_cid = cid.replace(cid[j:i],com_stars)
              i += x
              j += x
              cubiodList.append(n_cid)
          elif len(com_stars) == 3:
              x = len(com_stars)
              n_cid = cid.replace(cid[j:i],com_stars)
              i += x
              j += x
              cubiodList.append(n_cid)
      return cubiodList
      #print(i)
      #print(n_cid)
      # for item in cubiodList:
      #     print(item)
  
  print(cubiod_combo_gen(5,'*',1,2))
  
  print(cubiod_combo_gen(5,'**',1,3))
  </code></pre>