title: scoring a string based on a dictionary set of values
body: <p>I have a string </p>
  
  <pre><code>strA='ABCCBAAABBCCABABC'
  </code></pre>
  
  <p>and a dictionary(list of lists) of length less than that of strA (say length 4) which has the probability of occurrence of of each character at a given position:</p>
  
  <pre><code>{"A":[0.4, 0.5, 0.1, 0.2], "B": [0.3, 0.5, 0.3, 0.6], "C":[0.3, 0.0, 0.6, 0.2]}
  </code></pre>
  
  <p>I would now like to have a sliding window of length 4 and score my entire strA based on this dictionary.
  So the first 4 characters from srtA are ABCC and based on the dictionary, the score would be:</p>
  
  <pre><code>(p(A) at pos0)*(p(B) at pos1)*(p(C)at pos2)*(p(C) at pos(3))
  </code></pre>
  
  <p>=0.4*0.5*0.6*0.2
  =0.024</p>
  
  <p>Now I would like to slide this window in increments of 1 and find the highest score possible along the entire string for this window length.</p>
  
  <p>right now the way I am doing is:</p>
  
  <pre><code>    score_new=0
      window_len=4
      for a in range(0,(len(strA)-window_len):
              slide=strA[a:a+window_len]
  
              score=1
              for b in range(0,len(silde)):
                  score=score*(dict[slide[b]][b])
  
              if score&gt;score_new:
                  score_new=score
  
          return score_new
  </code></pre>
  
  <p>which works but is time consuming. I have to do this scoring for 10000 strings with 1000 different windows of variable lengths each having a different probability dictionary.</p>
  
  <p>Is there a quicker way to score the string based on a dictionary of probabilities and only return the highest score?</p>