title: I am trying to build a dictionary, but need to keep changing values
body: <p>for string(abcabcabc) &lt;abc * 3&gt;,</p>
  <p>dict[0] = a, then dict[0] = ab, dict[0] = abc,</p>
  <p>oh a repeat, next line
  dict[1] = a, etc.</p>
  <pre><code>test_case1 = 'abcabcabcabc'
  test_case2 = 'abccbaabccba'
  
  
  def case_test(s):
      case_test_dict = {}
      i = 0
      p = 'z'
      for x in list(s):
          if ((x != case_test_dict) &amp; (x != p))|((x == case_test_dict) &amp; (x != p)):
              case_test_dict[i]=(x) # &lt;--- problem
              p = x
          elif p==x:
              i +=1
      print(case_test_dict)
  
  print(case_test(test_case1), '\n', case_test(test_case2))
  </code></pre>
  <p>Basically, it'll output the last letter entry. I can't continue until I get that point nailed down.</p>
  <p>edit:
  Found an entirely alternate method</p>
  <pre><code>def case_test(s):
      case_test_list=[]
      for x in list(s):
          case_test_list.append(x)
          len_multi = len(s) / len(case_test_list)
          str1 = ''.join(str(e) for e in case_test_list)
  
          if (int(len_multi) * str1) == s:
              return len_multi
          
  print(case_test(test_case1), '\n', case_test(test_case2))
  </code></pre>
  <p>It outputs exactly the right answer I wanted.</p>
  <p>edit2: Forgot to add what that output is.</p>
  <p>The output is '4.0, 2.0' a count of the number of times the pattern is repeated.</p>