title: Dynamically slice a string using a variable
body: <p>I am trying to slice a string and insert the components into a list (or index, or set, or anything), then compare them, such that</p>
  
  <p>Input:</p>
  
  <pre><code>abba
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>['ab', 'ba']
  </code></pre>
  
  <p>Given a variable length of the input.</p>
  
  <p>So if I slice a string</p>
  
  <pre><code>word = raw_input("Input word"
  slicelength = len(word)/2
  longword[:slicelength]
  </code></pre>
  
  <p>such that</p>
  
  <pre><code>    list = [longwordleftslice]
      list2 = [longwordrightslice]
  
      list2 = list2[::-1 ] ## reverse slice
      listoverall = list + list2
  </code></pre>
  
  <p>However, the built-in slice command <code>[:i]</code> specifies that <code>i</code> be an integer.</p>
  
  <p>What can I do?</p>